My final project, a roller racing system for cycles, needs a small network to start a race timer, poll the speeds of two competing cyclists and to display the results. So, this week I designed the network to execute this.
My first step was to add a serial bus and an additional indicator LED for communications activity to the Hall sensor detector I made in previous weeks. I designed this using Eagle. I then made two circuit boards, one for each racer in the network. I also made a bridge circuit from the hello. bus. bridge design. I mistakenly thought that the bridge circuit was needed to interact with the nodes. On closer examination I found that the bridge is simply a node with a FTDI header, but with no difference in code.
I needed to complete two pieces of coding. The nodes’ program needs to detect the passing of a magnet using edge detection, count the number of detections in a second and transmit them with a node identifier. A Processing sketch needs to countdown a race start, communicate to the nodes that the races has started, decode the messages from the nodes and display the results.
The coding is still in progress. I have a functioning Processing sketch which I believe is working correctly. I am currently fault finding the C code for the nodes. They are successfully detecting and transmitting data. As I wrote the code for the previous implementation of the Hall sensor using the Arduino IDE, I wanted to use C this time and use the hardware timers on the Attiny44 rather than software. Thus, I am becoming familiar with interrupt routines and at the time of writing have designed a simple one which flashes a LED. Next steps will be to use this to transmit race data each second and then finally to ensure that the node receives data from the Processing sketch correctly.
The timer interrupt routine was successfully coded to send count data for the number of passes of the magnet each second. The next challenge involved combining this information with a node indentifier and transmitting the data. This is also working well now. The final step was to deocde the transmissions in the Processing sketch. I need to decode the transmitted string characted by character in order to identify and decode the speed data. This has now been executed. Some more work is needed to improve the count down and accuracy of the Processing sketch but effective communication between the nodes and the hub software has now been establsihed.