This Instructable shows the development of a shield for Arduino that can interact with Scratch and replicates the functions of the “Scratch Sensor Board”
Note: The present shield constitutes a so called 'derivative' from "Scratch Sensor Board", whose license can be found here. Further information about the original board can be found here
For the Impatient:
Final Arduino Sketch is here
Printed Circuito Board is here (eagle)
Schematics are here (pdf / eagle)
Step 1: Preparing Ground
After some time reading we found that the Sensor Board communication occurs via RS-232 at a speed of 38400 baud. It is good, because Arduino already have a Serial Port which means less circuits to implement.
The protocol between Scratch and Sensor Board constitutes of a ping pong mechanism. First Scratch application send a a data byte to the board then the board replies with sensor data. Nice.
The request packet is simply a byte with the value 0x01, whilst the sensor data consists of 9 high byte / low byte pairs (i.e. 18 bytes) spaced in time by a 400us interval.
The high byte / low byte pairs contains a 4 bit channel ID and a 10 bit Value. This is good, because if suits well with Arduino ADCs resolution.
For the Scratch Board Release 1 firmware and Scratch release 1.1 and later, the mapping between channel ID and sensor type is given below:
Channel / Sensor
0 / Resistance D
1 / Resistance C
2 / Resistance B
3 / button
4 / Resistance A
5 / Light
6 / Sound
7 / Slider
8-14 / Not Used
15 / Firmware ID (0x04)
From the 16 possible channels we have 7 analog, 1 discrete (on/off), 1 dummy (firmware-id) and 7 spare (not used now; maybe in a future version).