Short Project Description


Short Project Description


The concept of graphical programming enables teenagers and even younger children with creative access to computers. Scratch, a project of the Lifelong Kindergarten Group at the MIT Media Lab, provides not only the tool, but creates also a very inspiring environment for children, teachers and parents alike.
But sometimes creativity goes beyond creating "only" a program - physical interaction, tangible results become essential.

On the other hand, the Arduino project is quite famous and I'm impressed how well documented these microcontroller boards are, how easy they are to come by and how many slightly modified clones are around - all of them (Arduinos and clones) with a reasonable price tag. So it seems a good idea bringing Scratch and Arduino together.

This blog describes the advances step by step of setting up a robot controlled by an Arduino and easily programmed through a graphical enviroment. This project might be interesting to hobbyists, teachers, educators and parents (like me).

To allow for a maximum of creativity and flexibility the robot will use LEGO Technic / Education as the mechanical robotics platform.

Wednesday 19 February 2014

Controlling an Arduino by S4A using Bluetooth

Connecting the ITeaduino BT seems quite straight forward:
  1. configure Bluetooth transceiver on ITeaduino BT
  2. ensure Bluetooth on the connecting computer (i.e. laptop in our case) is configured correctly
  3. initiate Bluetooth device pairing between computer and ITeaduino BT
  4. configure S4A properly
  5. test connection running a program - e.g. make LED blink on Arduino's D13
But as always: The devil's in details

The following links prooved helpful to me:

 1. Configure Bluetooth transceiver on ITeaduino BT

After having tested the ITeaduino BT working in "normal" cable connection, I started configuring its Bluetooth transceiver. As described in Benjamin Bellamy's blog I set the Arduino clone to transceiver programming mode. How to configure the used HC-05 module can be found on the first link provided above.
In configuring the transceiver module I used the parameters given in ITead Studio's blog:
  • AT+ORGL (Restore the default state)
  • AT+ROLE=0 (Configure the HC-05 as slave)
  • AT+POLAR=1,0 (The LED will on when the output of PIO8 is high. And it indicates connecting successfully when the output of PIO9 is low.)
  • AT+UART=57600,0,0 (Set baud rate to 57600, one stop bit and no parity bit)
  • AT+INIT (Initializing SPP library)
As a terminal program I used AccessPort - but it should also work with the Arduino SerialMonitor, which I ruled out as it is by far not as comfortable as AccessPort.

N.B. I'm using the Arduino 1.5.4 r2 development tool - but I have NOT exchanged the “rxtxserial.dll” file as suggested. If I'm remembering correctly, I ran into problems with doing that...

I've also played with adding the the 1uF capacitor to the ITeaduino BT as described - but finally removed it again as I didn't want to programm the Arduino via Bluetooth (YES, this really works!!!)

2. Configure Bluetooth on the connecting computer

This seems to be a no-brainer. But with me it turned out to be a bit of a challenge to get the correct Bluetooth driver for Windows 8. Make sure it works correctly with another device e.g. a smartphone. And... at least for me, this took a considerable amount of time...

3. Initiate Bluetooth device pairing

 This is really straight forward: initiate Bluetooth pairing as described in ITead Studio's blog or as you're used with any other device. Don't forget the virtual serial port you're using for your Arduino...

4. Configure S4A properly

Using S4A 1.5 you have to program your Arduino with thw according firmware (S4AFirmware15.ino). To be shure, you should do this the "normal" way with an USB cable. Once downloaded to the Arduino I encountered S4A couldn't detect the Arduino, on the serial monitor you could see the Arduino send some gibberish.
A crosscheck with the S4A firmware helped on: at the very beginning of this sketch a data rate of 38400 baud is configured, whereas I've set the Arduino's Bluetooth transceiver to 57600 baud (see above). I decided to change the baud rate in the S4A firmware sketch instead of reprogramming the Bluetooth transceiver. And - heureka - S4A detects the ITeaduino BT via Bluetooth.

5. Test your connection from S4A

Once S4A detects your Arduino clone, you'll find it is working properly with your first Scratch program...

Mission accomplished.

4 comments:

  1. Thanks, very good post. Please upload the code for s4a communication with blutooth.

    ReplyDelete
    Replies
    1. You can find the appropriate Arduino firmware in the download section of Scratch 4 Arduino (http://s4a.cat) -- the direct link to the latest version (V1.6 by now): http://vps34736.ovh.net/S4A/S4AFirmware16.ino

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Your post and others were helpful to me in getting S4A to communicate with my Arduino Uno through an HC06. I can connect at 57600 and start to run a Scratch project (I can see values on the sensors and activate motors). However after a short time (30 seconds to a minute or so) S4A freezes and the BT connection drops (HC06 goes back to blinking).

    Any ideas?

    ReplyDelete