Steps Forward, Steps Back

Okay, things are sort of going ahead with the robot. I soldered up the old motor controller this morning, stripping components from a spare board. I could have hunted around for the FETs I needed but I’m pretty sure I don’t have enough and I didn’t want to risk using the ones from the damaged board.

Once that was done and I sprayed the new board and the Spot X main board with lacquer, I continued experimenting with PicoZero and managed to get the servo and the sonar to work. Looking at my existing code however, I might just keep using my existing servo code, since that works well enough and the calibration parameters are right there in the code. I’ll probably use some version of the sonar driver code but maybe make a few adjustments.

Once I was happy with the way the code was coming along I reinstalled the circuit boards into Spot X and connected up all the wires, doing a little cable management along the way. I decided to modify the sonar connection on the main board. It uses a 4 wire connection, but because I needed to give the sonar module 5v, I couldn’t use the connector as I’d designed it. Instead I used a 3 pin connector to gnd, trigger and echo with a single flying lead to a separate 5v pin. Nah, too messy. So I cut the 3.3v track to the sonar connector and soldered a link from 5v to the sonar connector vcc pin. A little untidy but, eh! It works, and now I can use a single 4 way header plug for the connection.

So then I decided to try testing out the circuitry on the robot. I plugged it into the USB (the battery power circuitry was disconnected) and all the bumper lights and the sonar deck lights lit up and the servo did a little twitch. Good signs so far. I loaded in a display test program, and boop! Error. Looking at a spare board I could see that I was trying to use the wrong pins, so I changed the pins and boop! Invalid pin error. Looking online and I quickly learned that I had to specify I2C channel 1. The constructor defaults to channel 0 unless you specify 1. Well I did that and the display started up. Great! I have a display.

Then I wanted to test the bump switches. i modified the program to create a set of 6 bumper objects and got the display to indicate which of the bumpers was being pressed. My goal was to map which Pico pin was connected to which bumper switch. So that all worked well, once I’d ironed out the kinks in the code. But then…

So there are 4 bump modules, each with 2 switches. The modules are arranged side by side, front and rear so there are 4 switches at the front and 4 at the back. This lets the robot detect collisions on the front left, right and centre and rear left, right and centre. In this iteration, I’ve designed the centre switches to connect to the same Pico pin, which means that there are effectively 6 switch positions the robot can discern. The outer switches should give separate signals while the two centre twitches should share a signal.

That works for the front bumper. The back bumper. No. On the back bumpers the left and right switches return the same signal while the centre two switches appear on separate lines. There’s nothing wrong with the design of the bumper PCBs. It’s that damn sensor breakout board again. Or rather, it’s that damn designer who didn’t check whether the connector pinouts were going to work and who got positive and negative mixed up.

For a moment I thought I could solve the problem by crossing over the wires from the sensor board to the rear bumpers but no, that didn’t work. Then I started considering swapping the connections on one of the bumper PCBs, but then I realised that I would have to do both and it would be an awfully bodgy fix.

Now as I sit here typing this, I realise that the best solution is to redesign the sensor breakout board and etch some more PCBs. That would allow me to fix all the issues with the sensor board. It would also give me the chance to do another version of the sonar deck, with the voltage divider properly accommodated, as well as redoing the design for the LEDs. I could also make a few LCD control boards that I’ve been designing. I don’t want to, but I think another batch of PCBs might be the best option.

Then no one will ever know how incompetent I was in the first place.

Leave a Reply

Your email address will not be published. Required fields are marked *