Greetings dear reader.
Saturday was quite eventful, as expected. With all the parts in place and (some of) the code ready, we embarked on the journey of construction. If you want, imagine the theme from "Lord of the Rings" playing in the background to give this post some more gravitas.
Nerd alert: Jack snuck in behind Richard and crammed in a bunch of technical details after this article was originally published.
Our focus this time was achieving our version of "Hello, World!" moving a motor based on commands fetched from the web:
Hardware, at least starting out, is pretty simple:
- A NodeMCU, an ESP8266 powered breakout-board. That's fancy for a $5 WiFi enabled, Arduino compliant microcontroller. Arduino is simple language for physical computing. That'll let
dummiesless advanced coders like us control things through the interweb!
- A logic level shifter (ended up not being needed). Our NodeMCU is 3.3V logic, everything else is 5V logic, so logics dictates we need something to "step up" the logic level so everything will play nice with each other (and not fry!).
- A stepper motor driver. Our motors are 24V and 3A and our microcontroller puts out 3.3V and 20mA. We obviously won't be driving our motors directly. We use a couple of TB6550 stepper motor drivers to translate commands from our MCU to movement of the motor.
- NEMA 23 stepper motors. Nice torquey, accurate motors in a compact package.
- A 24V, 15A power supply gives plenty of juice to run everything.
That mess above is how the day started. The first order of business? Connect our microcontroller and logic level converter on the breadboard:
So, it turns out that our logic level doesn't have enough oomph (current) to switch the motor controller off and on. Good news is that the motor controller, despite there being no documentation indicating as such, appears to accept a 3.3V signal, so we just ditched the logic level converter.
Then wire those into the motor driver:
Which, in turn, we connected to the motor (also pictured above.) Stepper motors have a specific wiring pattern. We were lucky that our eBay seller provided a pinout, otherwise we'd have to experiment to get it working.
Lastly, everything gets wired to the power supply.
Just like that, MoNet's motor was complete. Yes, really. Now, once the tracks are finished & attached, MoNet will be able to move its brush heads up/down/side to side.
"Complete" does not mean "it works perfectly on the first try."
We ran into several issues both with the code and with the motor itself (edit: all user error, of course). The MCU uses the "C" language to carry out commands like "spin the motor clockwise/counterclockwise" and the first noticeable problem was the fact that the motor wasn't spinning. At all.
But it was locked up! Which at least told us that it was hooked up correctly (stepper motors when "stopped" and under power will lock up and "hold").
Gareth and Jack were able to deduce and fix the problem rather quickly, but in coding, fixing one thing can break another. Meaning after the fix, the motor would spin one way, but not the other. Spinning counterclockwise caused it to crash (the software, not the motor - though that would've made for an interesting story) every time. Again, thanks to Gareth and Jack, the problem was solved some time later.
Side note: Check out our Facebook page for a video of MoNet's motor at work.
After that, our first session came to an end...but the next day Jack sent out an unexpected picture:
And it sank in that the first steps had been taken. 73 days left...let's see what happens next.
Until next time!