The wiring is rather simple but you will have to do a small modification to the battery pack.
Here is what you will be connecting.
You will want to connect the wires form the motors into the Motor terminals with one set of wires going into each side of 1 and the other set going into 2. If you mix up the wires all that will happen is your robot will drive in the wrong direction. Just switch the wires around if any of the wheels move in the opposite direction for what your code is saying it should do.
You will have to extend the wires from one motor so that they can reach the Motor terminals. You can do this by soldering new wires or just use some jumper wires to extend them.
For the Sonar sensor, you want to connect the following pins to the micro:bit breakout pins on the Crickit
- GND --> GND
- Echo --> Pin2
- Trig --> Pin8
- VCC --> 5V (this can go in the terminal for NeoPixel or Drive)
The Crickit is a bit picky about the amount of power that it gets, and with all the things we are adding, it is hard to maintain that power using the recommended 3 AA batteries. However, 4 AA batteries will trip the Crickit's eFuse and it will not let power in until we get things just right.
The easiest way to fix this is to use a 5V step down voltage regulator that can handle 2 Amps or more.
You could also use this one:
You will need to cut the battery wire in the middle and solder the voltage regulator between the battery box and the 5.5mm DC Plug just like in the wiring diagram.
The battery box and 5V voltage regulator should fit on the tom layer of your robot with plenty of room for the Crickit on top.
Now you do not have to use a speaker for this robot, but who doesn't like a robot that drives around all day playing Nyan Cat. The speaker can also be used to alert you when your new robot friend encounters an obstacle using the sonar sensor.
Just connect the wires to the two terminal blocks labeled Speaker.