HackerBox #13 included some IR sensors for use with the esp8266 controlled car. I tried some very basic circuits and programming to have the car follow a line. Overall, it was a pretty big fail. The car would follow the line at first, and then start correcting its course if it veered away from the line. These corrections would continue with the car doing ever larger left and right wobbles, and ultimately the car would wobble right off the line. Some Google searches indicated that this is a pretty common problem, and that a better way to approach line following cars is to use a sensor array of IR emitters and detectors such as the Pololu QTR-8RC and also to use a better algorithm such as PID control.
I had some extra time over the holidays, a bunch of IR detectors and emitters left over from an old project, and a Shapeoko 3 CNC mill that was a gift from last Christmas that had been collecting dust for a few months. So I figured I’d try designing my own sensor array with Eagle, milling the board with the Shapeoko 3, and then get around to building the line follower.
So I’m at the first step in the process – designing and milling the board. Before designing and building the array I figured I should get my feet wet first, so I decided to create a simple astable multivibrator circuit to blink some LEDs. My first step was getting Eagle downloaded and setup. There are many Eagle tutorials on the web already, and it’s pretty intuitive. Create a project, create the schematic, then layout the board. Then, find some software to create G-code and control the mill. Last, populate the newly created circuit board with parts. I have written a high level overview of the project below:
Here’s the Eagle schematic for the circuit:
And here is the Eagle board layout:
I’m sure there’s probably a better way to route the traces on the board, but this was my first effort, and the above layout is what I ended up using.
The next step was to find a toolchain to convert the board to G-code and subsequently to send the code to the Shapeoko 3. I first tried some various software to convert the board layout to G-code, and then load it into Universal G Code Sender. This worked, but it was a little clunky switching between multiple softwares.
Then I found out about Chilipeppr. Chilipeppr really simplified the process for me by allowing me to drag the Eagle board layout (*.brd) file into Chilipeppr and the software would handle creating the G-code, rendering the layout on screen, sending G-code to the mill, and auto-leveling the material. Basically, it did everything I needed it to do plus it’s setup to be forked and changed to suit your taste. Very nice.
This is a screenshot of Chilipeppr while my board was being milled:
Once the milling was complete, I tinned the copper and soldered in the components. Here is the freshly milled board (pre-tinning) resting on top of a box of BJTs for scale:
Adding a 9V battery brought my test circuit to life and the LEDs flashed as expected:
I’m sure my rookie efforts at making my PCB has plenty of mistakes, but it was one of the funnest projects I’ve completed in awhile. I also know I could just buy the sensor array from Pololu, but then I’d miss the challenge and fun of learning to do it myself. So I guess my next step is to design my sensor array in Eagle and post about it here.