Friday 5 October 2018

Arduino - I

In the first post on Internet of Things, we explore Arduino. Arduino is an inexpensive, platform independent, open-source electronics platform based on easy-to-use extensible hardware and extensible software. More details on Arduino are here. The language reference for coding in Arduino can be seen here. Arduino IDE is used for coding and the details are here. One can either use the online version or the local version. Link to the online version is here. The binaries for local installation are here. One can download the software corresponding to their OS: Windows, Mac OS X or Linux.

For the all the work in this post, we will be using the very elementary Arduino Uno. Details about Arduino Uno are here. To learn more about Arduino anatomy, one can see here. We will be using USB to power this board. For the IDE, we will use a local install on Windows. We have used this installer. The installation is very straight forward. For any help with installation, one can refer this link. The version is of IDE is shown below:

















At this point, we will assume that we are all set up with the board and the IDE. We enter code as shown in IDE below:




















To support running of the above code, we need a green LED, a red LED, a USB cable, connecting wires, a bread board, and an Arduino Uno board. The corresponding circuit is shown below.




















The circuit itself is elementary. Once we connect the USB cable to the laptop, we can set the board to Arduino Uno as shown below:

























We then set the port as shown below:















Once these two settings are done, we can save the code to a folder and file by navigating File -> Save As... and entering Signal in the window as shown below:






















This file is now saved as Signal.ino under Signal.ino folder. We can now compile this program as shown below:

















Once we compile, we can see the output Done compiling as shown below:










We can then upload the program to the Arduino board by navigating Sketch -> Upload or clicking the -> button just below Edit Menu as shown below:
















Once the code is uploaded, we can see the output as Done uploading as shown below:










We can now see the red and green LEDs light up alternately and not together simulating a traffic signal:






































This concludes our first post on Arduino