This week we studied ways circuits can talk to each other. We discussed wired links, such as SPI and I2C, and sped up the internet stack, touching on TCP/IP, PHYs, and all the other layers that make sites like this possible. Then we shifted gears and examined various types of wireless networking; WiFi, Bluetooth, and various ISM protocols. All of the methods were examined in the context of embedded electronics; the WiFi section, for instance, included a number of ESP32-based hello-world examples. Our assignent this week was twofold: first, design, build, and connect wireless or wired nodes with network or bus addresses; and second, send a message between two projects. I attempted but (as of the day of class) failed at the first, and didn't approach the second; to be fair, I'm not sure anyone else used the same radio protocol, so perhaps that part of the assignment can slide.
I got off to a late start on the assignment this week. I spent the weekend at the Hackaday Superconference in Pasadena, and between various other obligations didn't get started on the assignment until Tuesday evening, roughly 20 hours before class. Not a great excuse -- it was a hardware conference and we all spent a decent bit of time soldering, so I should have done the assignment over the weekend. In any case, I poked around in the CBA's various parts drawers and found a pair of nRF905 433 MHz data radios that came wtih nice little stubby antennas, which I grabbed along with a handful of other parts:
Neil linked to an open-source NRF905 library designed for both AVR-C and Arduino environments, so I decided to use a known compatible microcontroller platform -- the Atmel ATmega328P. I used KiCad to design a transmitter and receiver, taking care to wire the appropriate data pins to the microcontroller's SPI port (see files section for KiCad docs if you'd like a closer look):
I layed out the boards, quickly abandoning the normal single-sided board paradigm. No time for fancy routing, we'll figure out vias later! Famous last words...
Prior to getting dinner, I selected a pair of small DC motors with right-angle gearboxes and designed a quick press-fit wheel to 3D print:
As with previous projects, I eschewed straight KiCad board cutout lines in favor of something more organic which I designed in Inkscape. I ran into a funny bug I've seen before where the SRM20 plunges the end mill deeper than expected, resulting in a few lost pads and deep trenches between traces. I also made the vias a bit too small, so some of the holes didn't toolpath properly (and I was in a hurry, so I didn't notice). Milling:
In the end it all went together well enough, though the soldering around the module left much to be desired. Note the proliferation of 34 AWG bodge wires standing in for a second layer:
The controller went together similarly; once again the pin header soldering wasn't the nicest thing to look at, so I covered it up with a bit of shameful green electrical tape:
This time I used the 1/64" mill for the via holes so they were all there, and I was able to tuck the faux-second-layer bodge wires under the board:
At this point, I was racing against the clock to get the project done in time for class. I'd already given up on documentation -- document as you go! -- so I wanted something to work. But in the end, I wasn't able to get the radios talking to each other. I used an oscilloscope to verify each module was receiving SPI commands from the 328P, and checked the configuration header file, but when I connected the transmitter output to a spectrum analyzer I got a lower-than-expected peak of 408 MHz rather than 433 MHz:
I did this project in the wrong order. The radios are new to me; I should have set them up on my desk with a bare minimum configuration and gotten the modules talking, and then built the robot. But I wanted to do the fun part first. In any case, the next step here is to dig into the radio configuration routine and confirm that the devices are being set up properly, and that the transmit/receive functions are indeed getting called as they should. As of today, sillybot follows a preset routine that generally results in falling off a table:
As with previous unfinished HTM(A)A projects, for now I must move on -- Machine Week has started!