by Jeffrey Putney | Jun 2, 2015 | Fab Academy
Designing Network Controllable Stepper Motor Nodes For machine building week our group decided to try and create a 2-axis machine with a stage that could track the motion of a pen drawing on a tabled. My part of the project was to design networked arduino nodes that could be individually addressed and receive synchronization commands. I2C and Arduino We chose to use an I2C network for communicating between the Arduino nodes. The I2C standard includes allows for communicating with each node through unique addresses assigned to the nodes. It also provides support for a General Call address (specifically 0x00) that all nodes will respond to. The problem here is that by default the Arduino I2C library does on enable the General Call response feature. Enabling the General Call response in Arduino The ATmega has built in support for the I2C standard but it’s referred to as it’s Two Wire Interface in all of the documentation. In order to enable the General Call address we only need to add this one line of code in our setup function: TWAR = 0x03; Now is we send out a data on the I2C bus with a destination address of 0x00 all devices on the bus will receive the message. Node Protocol Each node can receive two types of commands. Either a setup move which consists of 6 bytes that define the number of steps, step direction, and speed of the move. The second possible command is synchronized move command that all nodes receive and initiated the start of a movement. Here is the code for an individual node: // Arduino based networked...