000webhost

Web hosting

Monday, September 5, 2011

Arduino Programming

Recently, an electronics store opened close by. This of course had its pros as well as its cons. The pros being that I have a place close by where I can get all sorts of electronic parts that I require. The con being sometimes you can get caught up in new pieces of technology. One of these pieces of technology happens to be Arduino electronics. There are obviously many different variations of compatible hardware but the most useful one that I came across that was in stock was the EtherTen.


Its basically a 100% Arduino compatible board that has an on board MicroSD card slot, an Ethernet port, as well as an ATmega328P MCU. Besides doing the usual LED blinker type experiments that you may have encoutered at University you'll also have the chance to interact with the outside world using all sorts of extra functionality such as wireless, LCD screens, motors, and enironmentel sensors. (details regarding this are available towards the bottom of this post)

Software Setup

1) Download software from, http://arduino.cc
2) Upon uncompression the you'll notice a arduino executable. Opening it will result in a minimalistic IDE for simple programming of the device itself.
3) Install the Windows USB driver if required via http://www.freetronics.com/pages/installing-the-usb-driver-file-for-windows (you won't require this if you're using Linux)
4) Select correct board by going to Tool > Board
5) Go to Tools > Serial Monitor to find out where device is going to be plugged in. Else just use dmesg and look for something similar to the following (if using Linux)

[ 8632.239231] usb 3-1: new full speed USB device number 3 using uhci_hcd
[ 8632.431914] usb 3-1: New USB device found, idVendor=20a0, idProduct=4150
[ 8632.431926] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[ 8632.431935] usb 3-1: Product: Eleven
[ 8632.431943] usb 3-1: Manufacturer: www.freetronics.com
[ 8632.431950] usb 3-1: SerialNumber: 64938323231351C0B1A1
[ 8632.435125] cdc_acm 3-1:1.0: ttyACM0: USB ACM device

6) Go to Tools > Serial Port and select the correct port on which the Arduino has been connected on.
7) You should see the blue LED on the board light up to indicate that the board has now been connected.

Running a Program on the Arduino
1) File > Examples > Digital > Name of Program
2) Sketch > Verify/Compile
3) File > Upload to I/O Board

You'll need to have avr-g++ installed as well as a number of other dependent utilities on Linux. I was using Knoppix Live ISO image so I tried downloading Debian packages obviously. I noticed that there were a few dependency oddities though including some that were not so easy to fix so I resorted to using the Windows version to get things up and running quickly.

Note, that Ethernet will not work without sufficient power. Funnily enough, a Linksys switch AC adapter works perfectly with the device (12V with + in centre) though it can cause the device to heat up a little. Note also that the LCD can be used without extra power although at a significantly lower brightness level.

Not everything is perfect. I had to upload compiled firmware twice a few times or else you may encounter limitations like this guy did here, http://robotjamie.com/etherten-firstlook Nonethless, its an incredible piece of hardware considering how inexpensive it is.

You may need to alter the default initialisation string from the example sketch if you do intend to use the LCD/keypad shield. Details of this were on the underside of the actual PCB on my particular 'Shield'.

Currently, I'm working on wireless transfer of information. Details of my progress on this experiment will follow later.



Chinese Style Noodle Soup with Dumplings Recipe, Random Stuff, and More

This is the latest in my series on quick, easy, and tasty meals: http://dtbnguyen.blogspot.com/2017/09/sweet-chilli-chickenporkbeef-noodl...