NETWORKS

Assigment: Design, build, and connect wired or wireless node(s)

with network or bus addresses and local input &/or output device

As seen from previous weeks, my boards kept working, but then breaking due to traces getting ripped off. Since I had both the motor and accelorometer together on one board, I had to redo both parts.

I wanted to modularize the two and separate them so if one breaks, I don’t have to redo the other.

Additionally, since I want the motor to move in accordance with changes from the accelorometer, it seemed risky to have to move the motor’s PCB in order to drive the motor itself.

I started out with separating the design from output week into two modules: Accel and Stepper.

I decided to try SPI, since I already used I2C to read data from the accelorometer. I made sure to break out GND, MISO, MOSI, SCK, RX, and TX (just in case!)

Networks
Networks Networks Networks

Networks

This rough diagram depicts the protocol. The accelorometer reds information as the “slave”, and sends the data over the MISO line (where slave writes).

Networks

The master polls the MISO line, and determines how to move according to accelorometer data.

The SPI library’s “transfer” function, helps us write data over the lines.

The accel slave fills up a buffer, which it transfers over. The master reads from the line, and based on the y-orientation, either moves up or down.

Accel slave checks if enabled (chip select), then sends over data.
Networks

Stepper Master (sets EN pin low (chip select), requests data, then sets back high)
Networks

Files

Accel Code Stepper Code