Tuesday, 12 November 2013
Measuring just 4 x 1.8 cm, this Atmel microcontroller board is now selling on Dealextreme.com for the unbelievably low price of $5.40, that's a 40% reduction on the normal price. It has 14 digital input/outputs, 8 analog inputs and 6 PWM ports.
You can order it here: http://dx.com/p/arduino-pro-mini-microcontroller-circuit-board-blue-5v-16mhz-178183?Utm_rid=55371787&Utm_source=affiliate
To communicate this device you need a USB to TTL level converter like this one which has an additional RTS line: http://dx.com/p/cp2102-stc-download-usb-to-ttl-module-w-dupont-cables-red-silver-202547?Utm_rid=55371787&Utm_source=affiliate
Tuesday, 16 July 2013
433 Mhz transmitter and receiver pair. These devices are now available from Dealextreme for the unbelievably low price of £1.85 ($2.80). Ideal for a wireless link to a remote sensor.
Friday, 28 June 2013
4x4 Matrix 16 Key Membrane Switch Keypad Keyboard - price reduction now only $2.60 from Dx.com.
Check out the link here: http://dx.com/p/4x4-matrix-16-key-membrane-switch-keypad-keyboard-117720?Utm_rid=55371787&Utm_source=affiliate
Tuesday, 25 June 2013
The "Eduino" which is a Leonardo clone is available from Dealextreme for $14.60 here:
I have finally got this device working properly. I used Tom Boyd's tutorial here http://sheepdogguides.com/arduino/ar3ne1tt.htm and adjusted his code slightly. Since my sensor was powered from the 5v line rather than using parasitic power, I was able to issue read slots and wait for a 1, indicating end of conversion. Initially I was getting errors approximately every few hundred readings. The data sheet indicates a 60us minimum period for read slots and 480 us for write slots. Increasing the 60us to 80us reduced the frequency of these errors. However I have now decided to use the Onewire library which includes CRC checking on incoming data.
Tuesday, 18 June 2013
My First Arduino Project!This is my first Arduino project which I started over a month ago. My intention was to get a basic system up and running and establish rudimentary comms with a PC. I have a background in programming Zilog Z8 microcontrollers for data loggers, so getting the hang of the Atmel processor was a case of brushing off the dust on my knowledge of these devices. Luckily libraries are available for programming the Arduino board so I didn't have to do any low level stuff as was the case with the Z8.
The project is broadly divided into two parts; the sketch which runs on Arduino, and the application running on the PC (Leonardo Terminal). The sketch implements a simple command interpreter for the Arduino board, specifically the Leonardo and the PC application is a terminal program which allows users to enter commands which are passed over the USB virtual serial port to the Arduino board. These commands instruct the microcontroller to set the states of digital outputs, generate and vary the duty cycle of a PWM signal, and read the state or value of digital and analog inputs.
The SketchIncoming data on the USB serial port is echoed back to the remote terminal and also to a 16 x 2 LCD display if used. Each character is appended to a command buffer. When a CR code is received,the contents of the command buffer are parsed to extract the command and its parameters. The command is then executed. Commands are translated to the Arduino digitalRead, digitalWrite, analogRead, analogWrite, Tone and noTone functions. The sketch can be used with the Leonardoterminal VB application or any terminal program. The syntax of commands understood by the interpreter is as follows:
DIN pin or DIN pin PU
Read the state on a digital pin, the optional parameter PU instructs the board that pull up resistors should be used. Value printed on LCD or output to serial port is 0 LOW, 1 HIGH
Output to a digital pin. state is 1=HIGH, 0=LOW
Read the value on the specified analog pin. Display to LCD and output to serial port
AOUT pin value
Implements PWM on the specified pin, value ranges 0-255. The frequency of the PWM signal is 490 hertz approx
TONE pin pitch duration
pitch is in hertz, duration is milliseconds
Turns off the tone on the specified pin
Leonardo TerminalThe application which runs on a PC was written in Visual Basic 2008. This application is a simple terminal program which can be used for communicating with an Arduino board, or any other serial device. Data is entered into a textbox and an adjacent textbox displays data received. Two text boxes allow strings of data to be sent when "send" buttons are pressed. The following functions on the form are specific to an Arduino board:
Monitor Analog Input
Displays the value read from the specified pin. The pin is scanned every second
Monitor Digital Input
Displays "HIGH" or "LOW" depending on the state of the specified pin. Results are updated every second
Enables PWM on the specified pin and the duty cycle for the PWM signal is set by the position of the wiper on the tracker bar
Commands entered into the Data Sent text box are translated to the Arduino digitalRead, digitalWrite, analogRead, analogWrite, Tone and noTone functions.
Data can be written to an Excel file, however you must have Excel installed for this to work. I have only implemented logging of data on the chosen analog channel. Files can be appended or overwritten.
The software detects when a USB cable cable is plugged in and updates a list of available ports. When the cable is unplugged, the list is re-populated.
ImprovementsThere is a lot of room for improvement in the code. Rather than using a text based protocol for requesting and setting the states of pins, data could be sent and received in packets in binary format. Instead of using digitalRead, analogRead and other Arduino functions for getting/setting the states of pins, registers could be read directly and results sent as a block of data.
The advantage of a text based protocol however is that any terminal program can be used for checking/setting pins without the requirement to encode/decode data.
No error checking is implemented. Checksums could be added to sent and received commands/responses for basic validity checking of data.
The Leonardo Terminal application only receives and sets one pin at a time. Future versions will allow the full range of inputs/outputs on the board to be controlled. So for example the user can choose whether a pin is input or output, PWM output and if it should be logged.
Parts RequiredLeonardo board from Dealextreme.com or other supplier.
DX.com don't appear to stock an official "Made in Italy" Arduino Leonardo anymore. However you can buy an "Eduino" clone version for $14.60 here:
2 x 16 LCD display also from DealExtreme
The one I bought had a blue display with white characters. You can buy it here:
However the backlight must be illuminated to read the characters. An alternative is this one with black characters on a yellow/green background:
You also need a strip of pin headers if you want to plug the LCD into a breadboard.
Breadboards can be bought from DX.com here:
Breadboard ConnectionsThe breadboard setup was drafted using Fritzing which can be downloaded here: http://fritzing.org/
I used an Uno board instead of a Leonardo, however the pin connections are the same.
5 volts and ground from the Leonardo feed the two top rails of the breadboard. Only 4 data lines of the LCD need to be connected to the Arduino. A 10k pot is used to adjust the contrast on the LCD display.
Johan van Tongeren has some information and close-up photos of connecting this type of LCD here:
This is the schematic:
You can download the sketch here:
This is a screen dump of the Leonardo Terminal program
........and you can download the Leonardo Terminal VB code here. Unzip the folder into your Visual Studio projects folder.