Processing – interface on steroids

Everyone who become interested, will, rather sooner than later, stumble on the name Processing. Processing is the software on which Arduino IDE is based. But, it isn’t the only common thing.

At first – what is the Processing?

It’s a programming language (under an open source license) with IDE environment created for the people involved in electronic arts and visual design communities (by the Wikipedia).
More clearly? Just look over, for example Vimeo for tag processing.org. Or processing group on YouTube. Data visualization, multimedia experiments, etc. We are able to see, for example, train traffic in Melbourne:

Ebb and Flow of Melbourne Trains by Flink Labs from Flink Labs on Vimeo.

Exactly, and from where the data comes? Well, it might be from Arduino, whose sensors can provide quite a lot of various data to visualize

Now I will give a simple recipe how to use the Arduino and Processing to build … an oscilloscope :) . Oscilloscope is too much said – visualization of the voltage on a single analog input is better description.

Continue reading “Processing – interface on steroids”

SelFly – from the space by glider

SelFly is an interesting (IMO) project of an autonomic (with autopilot) glider which will, elevated to a high altitude (about 30 km) with a weather balloon return home on its own. Good base for further experiments.

All the more I was glad it’s Polish, domestic production :) . I hope the entire project will succeed. Maybe this success would encourage more people to implement their own (sometimes a little crazy, but by that fantastic) ideas.

And this information is here because what will control the glider? Of course – you have guessed – Arduino.

Have you got any Cray soft in your drawer?

Chris Fenton, an electronics engineer living in NYC is making various DIY projects in his free time, such as notebook based on Picaxe uC (v1 and v2). These project aren’t always very sensible :), because who really needs this notebook, but have pretty high educational value. While reading article about 2-stage light gas gun (for obvious reasons, ended with an explosion ;) – so it’s worth reading to find out why), a quote caught my eye:

My Mom actually made me collect all of the pieces, lay them out, and try to root-cause the failure. Whatever happened to just grounding someone?!

Cool mom – making to root cause analysis.

Cray-1
Cray-1 (C) by http://www.flickr.com/photos/keitamiyoshi/

But, to the point: the next project is a copy of supercomputer (actually it was super in the 70s) Cray-1 based on FPGA. The biggest problem – lack of software supporting it, to check if it really works like true. If you have any, you can help with testing it :)

Or – you can make your own Cray, if you wish :)

Self-made Arduino shield – making a PCB

Sooner or later, everyone bitten by Arduino bug would want to make his own extension. At the beginning Proto Shield may be sufficient.

When we have a working prototype, we might want to convert it into a series model, so PCB board will be needed.

PCB
Time for self-made PCB CC by http://www.flickr.com/photos/odinhg/

On Arduino Forum there is a link to a very nice tutorial, how to make our own PCB board, especially for Arduino shields.

Aaron Eiche, author of the article is a member of DorkbotPDX group, which makes orders for PCBs and everyone can order with them the price is quite attractive – $5 for square inch of a double sided board + $15 for shipment (worldwide). It must be ordered in multiples of 3.

Magic glove

From time to time, in Arduino world there comes up a project, which is simply breathtaking. Everyone likes something different, but this thing is really sensible.

The glove
The glove and whole device asssembled (c) http://www.flickr.com/photos/45901891@N07/

At first glance you may think – another glove for VR or controlling some console.

Not exactly…

This is automatic sign language translator. Thanks to an accelerometer and flex sensors (tensometers) Arduino Mega is able to read the sign with Bayes filter. After that Arduino translates it to a text displayed on a LCD and synthesized using VoiceBox. Hats off.

You can read more here.

Galvanic isolation: optocouplers

For sure, you have heard the term galvanic isolation many times. In brief, it’s about separating the source of signal from the microcontroler in order to prevent it from unwanted and dangerous voltage spikes, while allowing to read the signal.

Such a separation is provided by optocouplers. The optocoupler contains in common package both infrared LED diode and photodetector, such as photodiode or phototransistor.

How to utilize this invention? On Australian hacker’s blog there is a tutorial explaining what is an optocoupler and how to read its parameters.

Arduino Shield List

While browsing links, which I collected during the weekend I noticed a intriguing site useful for everyone who utilizes Arduino.

I’m talking about Arduino Shield List, and the title perfectly describes, what it is – a collection of informations about shields – who manufactures, which pins are used for what, etc.

Observe it, even though the list isn’t yet completed, but when it will be, this might be excellent index of everything available for Arduino.

I2C in a slightly different way

In Arduino IDE there is Wire library available, supporting I2C protocol (you can read about it on Arduino pages, in irreplaceable Playground section).

I2C
I2C - Boarduino and BlinkM joined together via I2C. CC by http://www.flickr.com/photos/ladyada/

Todd Kurt wrote on his blog that he will make the code of a new library for I2C – SoftI2CMaster accesible through various projects related to BlinkM.

How it differs from Wire?

First, it’s software implementation. It doesn’t utilize internal I2C module. As a result – it works only in Master mode (it can only transmit), but it’s not tied to pins A4 and A5, as is the case with the internal module. SoftI2CMaster can use any of the digital inputs/outputs. Moreover, the library is written so as to cope better with interferences and noises on the line. Thanks to that, it can work at greater distances.

For sure there will be good application for it in your projects :)

Arduino Bluetooth on Ubuntu

Arduino Bluetooth – Arduino without USB port, with Bluetooth module instead. Ideal solution if wireless communication with Arduino is needed.

At first – some differences to an ordinary Arduino Duemilanove. Arduino BT is based on ATmega168, so we have a little less memory at disposal. There is no USB port, so we have to power the board on our own.
If we’re talking about power – Arduino BT is vulnerable to supply voltage polarity, so connect ground and Vcc to the board with attention! What’s more, maximum supply voltage is only 5,5V! Fortunately, thanks to DC/DC converter, the minimal voltage is only 1.2V.

Arduino Bluetooth
Arduino Bluetooth

Because there is no USB port, the programming is also performed through Bluetooth. A short instruction how to do it – Ubuntu 9.10.

I didn’t utilized Ubuntu GUI to configure the connection, probably it also will work ;)

At first (of course after turning Arduino BT on) we search for available devices:

$ hcitool scan
Scanning ...
	00:07:80:91:30:09	ARDUINOBT

Here is the found module. 00:07:80:91:30:09 – it’s MAC address of the device and of course it’s different for each device. It should be replaced with the proper number of your Arduino everywhere below.

Now we are connecting to the module:

$ sudo hcitool cc 00:07:80:91:30:09
$ sudo hcitool auth 00:07:80:91:30:09

Possibly it will ask you for PIN – default is 12345.

We need informations about this device:

$ sdptool browse 00:07:80:91:30:09
Browsing 00:07:80:91:30:09 ...
Service Name: Bluetooth Serial Port
Service RecHandle: 0x10000
Service Class ID List:
  UUID 128: 00001101-0000-1000-8000-00805f9b34fb
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 1
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100

Important informations are RFCOMM and Channel 1. RFCOMM is a serial port emulation protocol for radio transmission.

Now we can write to /etc/bluetooth/rfcomm.conf:

rfcomm0 {
	bind yes;
	device 00:07:80:91:30:09;
	channel	1;
	comment "Arduino BT";
}

Of course channel may have the same value as returned by sdptool. Having it written in the configuration file we are able to connect:

$ sudo rfcomm connect 0
Connected /dev/rfcomm0 to 00:07:80:91:30:09 on channel 1
Press CTRL-C for hangup

Now it remains to set minicom -s the port to /dev/rfcomm0 and we should be connected to Arduino serial.

In theory :) Arduino BT should be programmed with the following code (original without formatting) by deafult:

/* BT test 01
* ——————
* Massimo Banzi
*
*/

int LED = 13; // select the pin for the LED
int RESET = 7;

void setup() {
pinMode(LED,OUTPUT); // declare the LED’s pin as output
pinMode(RESET,OUTPUT); // declare the LED’s pin as output
Serial.begin(115200); // connect to the serial port
digitalWrite(RESET, HIGH);
delay(10);
digitalWrite(RESET, LOW);
delay(2000);
Serial.println(“SET BT PAGEMODE 3 2000 1”);
Serial.println(“SET BT NAME ARDUINOBT”);
Serial.println(“SET BT ROLE 0 f 7d00”);
Serial.println(“SET CONTROL ECHO 0”);
Serial.println(“SET BT AUTH * 12345”);
Serial.println(“SET CONTROL ESCAPE – 00 1”);
Serial.println(“SET CONTROL BAUD 115200,8n1”); //first release 19200
}

void loop () {
digitalWrite(LED, HIGH);
delay(100);
digitalWrite(LED, LOW);
Serial.println(“ciao”);
delay(1000);
}

It should – but from my humble experience, it usually comes from a factory with classic blink – digital pin 13 lights up and blows out. So it is in the code above, but it also should write “ciao” message on the serial. I haven’t yet succeeded to get the message with ‘fresh’ Arduino BT (at /dev/rfcomm0 there was silence all the time), however the 13th pin in fact was blinking (Arduino BT hasn’t LED diode on board, so you have to connect it).

It only remains to load the code above on the board. The best idea is to set BT in Arduino IDE permanently and add the following code to ~/.arduino/preferences.txt file:

serial.stopbits=1
serial.databits=8
serial.parity=N
serial.port=/dev/rfcomm0
serial.debug_rate=115200
serial.burn_rate=115200
board=bt

Now the program can be loaded without any problem. Note – even if Arduino tells it uses /dev/ttyS0 or USB0, with the abovementioned entry to preferences.txt it should be loaded through rfcomm0.

Loaded without any problem – but only when you know how. Well, the latest Arduinos equipped with USB have a firmware allowing to load new code at any time (the board is resetted through USB and new code is loaded). Arduino BT firmware doesn’t support this useful function, so we have to reset the module manually (S1 button) and press “Upload” in IDE in one second.

After such a procedure the program will be loaded easily and from now on minicom will show ciao.

Arduino BT is available on nettigo.pl – in small amounts, bigger are on request (maximum waiting time – a month).

3 in one – RGB diodes

Our blog has received support – a new writer (attentive reader probably know already who it is :) ), so new interesting posts are being prepared, while I am preparing, as usual, some colorful lights :) .

Let’s begin from the end – a short movie. It isn’t impressing, because mobile phone camera doesn’t reproduct the colours well.

What to do… Well, maybe pictures of the assembled circuit.

RGB LED
RGB LED

Now it’s already known what the title RGB diode is – three LED diodes in one: Red, Green, Blue.
Common cathode, so easily controlled from Arduino – only connection (through 220 Ohm resistor) between proper terminal and Arduino digital pin is required to control one colour.

Which terminal is which? The following picture will be helpful:

Describing from the left side, we have: blue, green, ground, red. The longest terminal of it is ground and this lets us see how to connect the diode.

What gives us such a diode? Well, we can produce every colour by mixing three base colours in varying amount. To illustrate this, I will present the code used in first example. The idea is to light every single colour with different intensity (using PWM) and different frequency.
We are getting a mixing colours effect in this way:

int LED1 = 9;
int s1 = 255;
int LED2 = 10;
int s2 = 255;
int LED3 = 11;
int s3 = 255;

unsigned long int tme;

void setup() {
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
};

void loop() {

  analogWrite(LED1, s1);
  s1 = sin(tme*tme/50000.0)*128+128;

analogWrite(LED3, s3);
  s3 = sin(tme*tme/100000.0)*128+128;

  analogWrite(LED2, s2);
  s2 = sin(tme*tme/70000.0)*128+128;

  delay(15);

  tme++;
};

tme is variable representing the time elapsed. In loop, tme square value is divided by a sort of values and sinus is calculated from them. Thanks to it we have three different waves (of different frequencies) and every controls one colour. Since square is a non-linear increasing function, the phase offset of every wave should vary across time (I think so, but maybe this should be checked out precisely). Because of that the colours are mixed differently and not in a fixed sequence.

The side effect is that with time, the changes become more frequent and the diode is blinking faster and faster…

If someone needs such a diode – it’s available in Nettigo.