{"id":1263,"date":"2014-06-05T13:34:30","date_gmt":"2014-06-05T11:34:30","guid":{"rendered":"http:\/\/labalec.fr\/erwan\/?p=1263"},"modified":"2014-06-07T20:32:53","modified_gmt":"2014-06-07T18:32:53","slug":"arduino-use-a-transistor","status":"publish","type":"post","link":"https:\/\/labalec.fr\/erwan\/?p=1263","title":{"rendered":"Arduino : use a transistor"},"content":{"rendered":"<p>A common mistake with Arduino beginners is to use the board to deliver power .<br \/>\nAltough it is ok for small devices such as sensors, leds, etc, it can only deliver 40ma (per pins) which wont work for more needy devices such as motors.<\/p>\n<p>There comes the transistor which lets a small current control a much larger one and your Arduino can therefore manage devices\u00a0which are power supplied from a separate source.<br \/>\nThere are 2 sort of transistors : the <strong>PNP<\/strong> and the <strong>NPN<\/strong>.<br \/>\nThe PNP will turn on with a LOW signal whereas the NPN will turn with a HIGH signal.<\/p>\n<p>A transistor has 3 pins (looking at the labelled \/ flat side), from left to right : (C) the <strong>collector<\/strong>, (B) the <strong>base<\/strong>, (E) the <strong>emitter<\/strong>.<br \/>\nThe collector is connected to the negative pin of the device. (the positive pin of the device being connected to the positive power supply)<br \/>\nThe base is connected to the digital pin of the arduino.<br \/>\nThe emitter is connected to the ground.<\/p>\n<p><a href=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2014\/06\/NPNvsPNP.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1267 size-medium\" src=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2014\/06\/NPNvsPNP-300x211.png\" alt=\"NPNvsPNP\" width=\"300\" height=\"211\" srcset=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2014\/06\/NPNvsPNP-300x211.png 300w, https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2014\/06\/NPNvsPNP.png 800w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>See below the wiring<\/p>\n<p><a href=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2014\/06\/transistor2_bb.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1273 size-large\" src=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2014\/06\/transistor2_bb-1024x520.png\" alt=\"transistor2_bb\" width=\"695\" height=\"352\" srcset=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2014\/06\/transistor2_bb-1024x520.png 1024w, https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2014\/06\/transistor2_bb-300x152.png 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/a><\/p>\n<p>The the Arduino sketch is rather simple<\/p>\n<pre>int Pin = 9;\r\n\r\nvoid setup(){\r\npinMode(Pin, OUTPUT);\r\n}\r\n\r\nvoid loop(){\r\ndigitalWrite(Pin, HIGH);\r\ndelay(2000);\r\ndigitalWrite(Pin, LOW);\r\ndelay(2000);\r\n\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A common mistake with Arduino beginners is to use the board to deliver power . Altough it is ok for small devices such as sensors, leds, etc, it can only deliver 40ma (per pins) which wont work for more needy devices such as motors. There comes the transistor which lets a small current control a <a href='https:\/\/labalec.fr\/erwan\/?p=1263' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-1263","post","type-post","status-publish","format-standard","hentry","category-arduino","category-18-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/1263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1263"}],"version-history":[{"count":10,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/1263\/revisions"}],"predecessor-version":[{"id":1299,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/1263\/revisions\/1299"}],"wp:attachment":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}