Showing posts with label Arduino. Show all posts
Showing posts with label Arduino. Show all posts

Saturday, 18 April 2015

Installing Arduino IDE

In the last article unboxing and connecting the Arduino UNO was described. In this article how to install the IDE will be discussed. Primarily Fedora and Linux generic installation will be discussed.

Fedora

Fedora and all redhat derivatives uses yum for installation and de-installation. The easiest way to install Arduino IDE under Fedora is to issue the following command
~$ sudo yum install arduino
This command will download and install arduino package and its dependencies. After installation is complete, from terminal  bellow command should be issued.
~$ arduino
This will start the arduino IDE and flash a message box. The message box will ask to add the user to few groups;  Ok should be choosen here. Then it will show after the user login again changes will take effect. So just logging out and logging in is required at this point. Now the system is ready.

The arduino IDE can be started from terminal like above or it can be started from GUI Menu ( Programming -> Arduino ). Once the IDE is started, be familiarize with all the tabs and menu entries in arduino IDE. If arduino board is connected to the system via USB cable then "Tools" tab should be checked. Under "Tools" tab the "Boards" entry it should be checked and it should show the board attached or else the board should be selected manually.

 Next the "Serial Port" entry under the "Tools" tab should be checked. it should be enabled and should show the port, to which Arduino board is connected. In my case it shows "Arduino UNO" ( This is default) and "Serial Port /dev/ttyUSB0".

Hello World

Till this point it seems good. It is time to try out some adventures. for this purpose Select "File -> Examples -> basic -> blink". Corresponding sketch will be opened. Then from "Sketch" tab "Compile/Verify" should be selected. this will Compile the sketch. Next "Upload" should be selected from "Files" tab. When the uploading completes, a message will be flashed. 
Great ... The LED is blinking.

Concluding Remarks  

Here we discussed yum based installation. It is suitable for lazy and Dummies like me. But if some one want to try the harder way then please download the sources and be prepared to wait at least 3 hours until your cross compiler is ready and then manually setup everything. I am afraid of doing this adventure but this will teach how or what are the steps needed for cross compiler generation and setting up a cross compiler environment, Very Good exposure...

Blink sketch is just to check if the whole setup is working properly or not. One can try few other sketches from example too.

This concludes our second instalment in Arduino adventure. Stay tuned for the next instalment.

NOTE:  A nice document describing installation methods is available from Sparkfun here.

Thursday, 16 April 2015

Arduino UNO Adventure

Hello friends,
Priyasloka generously donated me an Arduino UNO. Though I have experience in other embedded board development, this is first time i am soiling my hand with Arduino.

This will be a series not a big chain of series. But few small parts. dealing with basics to some level of programming.

 Comparison of Arduino UNO with PIC microcontroller development board.

I have used PIC 18F4550 boards. Those board has one advantage, if a boot loader is burnt, then it is detected as a USB storage device and just copying the compiled code is sufficient. But to burn the bootloader, serial port (UART/USART) is needed. 
Arduino UNO has a serial to USB converter onboard. Which is better for beginner and dummies like me.( I hate External programmer and JTAG ) Geeeee

Getting started

I use Linux(Fedora) for casual use and also for my bread and butter.
so i decided to use my Fedora laptop for arduino adventure.

Arduino UNO has micro USB connector which is used for powering the board
as well as communicating with the board. Though UNO has a DC power supply connector.
We will get a micro USB cable which can connect to Arduino and laptop.
Mobile phone/smart phone charger cable might work for this purpose. (WARNING... I DON'T GUARANTEE IT)

We get a USB connector which connects to Arduino UNO and laptop. Bellow is the dump of messages linux throws.
Apr 16 11:36:13 localhost kernel: [ 1552.431146] usb 3-1: new full-speed USB device number 2 using uhci_hcd
Apr 16 11:36:13 localhost kernel: usb 3-1: new full-speed USB device number 2 using uhci_hcd
Apr 16 11:36:13 localhost kernel: [ 1552.583165] usb 3-1: New USB device found, idVendor=1a86, idProduct=7523
Apr 16 11:36:13 localhost kernel: [ 1552.583183] usb 3-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
Apr 16 11:36:13 localhost kernel: [ 1552.583191] usb 3-1: Product: USB2.0-Serial
Apr 16 11:36:13 localhost kernel: usb 3-1: New USB device found, idVendor=1a86, idProduct=7523
Apr 16 11:36:13 localhost kernel: usb 3-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
Apr 16 11:36:13 localhost kernel: usb 3-1: Product: USB2.0-Serial
Apr 16 11:36:14 localhost mtp-probe: checking bus 3, device 2: "/sys/devices/pci0000:00/0000:00:1d.1/usb3/3-1"
Apr 16 11:36:14 localhost mtp-probe: bus: 3, device: 2 was not an MTP device
Apr 16 11:36:15 localhost kernel: [ 1554.157815] usbcore: registered new interface driver ch341
Apr 16 11:36:15 localhost kernel: [ 1554.157850] usbserial: USB Serial support registered for ch341-uart
Apr 16 11:36:15 localhost kernel: [ 1554.157880] ch341 3-1:1.0: ch341-uart converter detected
Apr 16 11:36:15 localhost kernel: usbcore: registered new interface driver ch341
Apr 16 11:36:15 localhost kernel: usbserial: USB Serial support registered for ch341-uart
Apr 16 11:36:15 localhost kernel: ch341 3-1:1.0: ch341-uart converter detected
Apr 16 11:36:15 localhost kernel: [ 1554.170609] usb 3-1: ch341-uart converter now attached to ttyUSB0
Apr 16 11:36:15 localhost kernel: usb 3-1: ch341-uart converter now attached to ttyUSB0
 The above messages shows us that the device(UNO) has ch341 UART converter chipset, and the virtual serial port assigned to ttyUSB0.
In Unix language it will be /dev/ttyUSB0. Your board may show different USB tty so dont panic. see the messages dumped by your system.
In the Next article I will explain about Arduino IDE instalation.

Neural Network from Scratch Using C (Part-3)

  XOR Problem In part 2, AND gate and OR gate could be trained using a single perceptron. But XOR gate could not be as it is not linearly...