February 26, 2013

Arduino IR remote library

If you have an Arduino project where you need to handle remote control infrared signals you should have a look at IRremote library by Ken Shirriff. It recognizes many commonly used protocols and can also capture and send raw data for unknown protocols. Download it from his github page:
https://github.com/shirriff/Arduino-IRremote

I used the provided example named IRrecord to receiving and transmitting codes with my Panasonic TV remote. It was recognized as raw and it worked well to learn codes and send it to control my TV. A clever trick to see if you transmitter is working is to use your smart phone camera. Looking at the IR led in the camera viewer enables you to see the IR light.
Here is how to wire the sensor and the IR led, the button is is used to send the last captured code.


By opening the serial terminal the captured code can be viewed. It shows the length of the mark and space in the code.

February 20, 2013

Connecting Arduino to MK802 running Lubuntu


I had an idea of combining a MK802 running Linux with an Arduino UNO to get some I/O pins controllable from the MK802. This post describes how to do serial communication over the USB cable with a terminal application and with Python.

Boot Lubuntu and login then connect the USB cable from the Arduino to the MK802 and open a LXTerminal and type:

dmesg

It will print of lot of information but look at the end for lines similar to these:

[  217.500000] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[  217.510000] usbcore: registered new interface driver cdc_acm
[  217.510000] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

This means that you Arduino is mapped on the device name ttyACM0. To open a serial terminal to this device type:

screen /dev/ttyACM0

If screen is missing install it by typing:
sudo apt-get install screen

Below I have run screen with the example "Communication -> ASCII table" from the Arduino Software. I prepared the Arduino UNO with the code on a Windows computer before  I connected it to the MK802.


The serial communication can also be done with a Python script. Create a file named Arduino.py with the lines below it an run it with:
python Arduino.py

import serial
ser = serial.Serial('/dev/ttyACM0')
while 1:
  while ser.inWaiting() > 0:
    print ser.readline()
 
It should result in a something similar to the picture below.

February 15, 2013

Installing NewPing library for Arduino

Just for fun I decided to play with an ultrasonic sensor for distance measurement and an Arduino. The sensor that i used is the HY-SRF05. The included example for Arduino is written for the Parallax PING sensor. The HY-SRF05 is a bit different from the PING in the sense that it uses two pins for communication instead of one. This is not supported by the default example. But luckily there is a good alternative. The NewPing library has many features and support the HY-SRF05. It is available for download from here: http://code.google.com/p/arduino-new-ping/

The installation of an Arduino library is easy. Just unzip the library files in your Windows Documents folder in the folder Arduino\libraries\<LibName> as illustrated below.

 

The library integrates well in the Arduino Software and comes complete with examples.

The HY-SRF05 runs from 5 Volts so it is easy to use with the Arduino. The trigger pin is connected to pin 12 and echo pin to pin 11 on the Arduino. This is how it looks when it is running.
The accuracy of the sensor seems to be fairly good but I did not evaluated that throughly.

February 11, 2013

Inkscape - Editor for SVG files


Inkscape is a free and open source vector graphics editor. I have used it for editing of images for Fritzing parts with good results. You should not be fooled by the low version number. This is very capable software. If you looking for a free alternative to Adobe Illustrator this is a good candidate. Below is the SVG file for the Fritzing part for the JY-MCU Bluetooth module that I made. The SVG file is available for download from here.

February 6, 2013

Practical low cost SMD components kit


A couple of months ago I ordered an SMD components kit on ebay. I have used it for some time and I have to say I like it! It is small and has the most common values of the components. In the picture below you can see a size comparison with an Arduino UNO.


The kit is a book with resistors and capacitors in pockets with labels. It has 3025 of resistors in 63 values from 0Ω to 2MΩ and 700 capacitors in 17 values from 15pF to 1uF. The component size is 0805 (2.0x1.25mm).

Search on ebay for "Practical SMD resistor and capacitor components, assorted folder kit" The price is about $32. I am not associated with the seller of this item.