The first thing to do is read the documentation (here
) to find how do the Sensor Board interacts with Scratch.
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
/ Resistance D1
/ Resistance C2
/ Resistance B3
/ Resistance A5
/ Not Used15
/ 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).