The MC-1, abbreviation for Monster Car 1, is based on parts of a car that once was remote controlled. My wife chose this name because she thinks it is ugly as a monster.
The front wheels are turned by a solenoid. Since the current provided by the L293D is limited, I created this workaround. When the servo moves, it causes the paper clips to close an electric circuit and activate the solenoid.
I have created a standard for the wiring–The connectors that provide power are females and the one that receive power are males. Hence, I don’t have energized male connectors touching each other causing short-circuits. I used glued tape to group the wires together and label them. In this way, it will be easier reconnect the chassis to the board.
I used Velcro to attach the breadboard and the Raspberry Pi to the car. This is how the final assembly looks like.
I bought this car in a second-hand-stuff shop. Originally it was remote-controlled but when I bought it, it no longer had the remote control. I don’t know the motor specification. This car has five AA batteries (7.5V), so I think it is safe to use my 5V power source. I put it on a box to avoid it to run away.
This time I used the L293D attached to GPIO 18 and 23 in a way I can make the motor run forwards or backwards.
I used the Servo Blaster library as presented on Day 14. In order to run the motor forwards, I kept one signal at zero and changed the other one.
echo "2=0" > /dev/servoblaster
echo "5=500" > /dev/servoblaster
To run backwards, I inverted the signals:
echo "5=0" > /dev/servoblaster
echo "2=500" > /dev/servoblaster
It worked with values from 300 to 2000.
When the motor runs forwards, the white LED is on. The LED is connected after the L293D.
When the motor runs backwards, the green LED is on. The LED is connected before the L293D.
This time I replaced the red LED in the circuit I used on Day 11 for a ultra bright white LED.
The white LED requires more power than the Pi can provide, so I added the external power source used on Day 9 and a motor control chip, the L293D. I did the wiring based on this Adafruit tutorial but my Cobbler is connected in the inverted position.
This is the final circuit:
- I used the following wire color guidelines: Black for ground, Red for Vcc, Yellow for data, and Blue for control.
- The white LED can take up to 80mA and is connected to 100/3 = 33 Ohms resistor.
- The green LED is connected to a 330 Ohms resistor.
- I used an external 5V power source connected to the bottom-right corner.
The following picture shows the connections from another direction:
This is the final result:
This time, I used ultra bright white LEDs. These LEDs work in a higher voltage (3.0 to 3.8V) and can take a higher current, too.
The first one has 140,000 mcd of luminosity in a 12 degree viewing angle. I used a 100 ohms resistor to limit the current to 20 mA:
The second one has a 30 degree viewing angle and can take up to 80 mA. I used two 100 ohms resistors in parallel resulting in 50 ohms, implying in 50 mA of current:
The problem with the second one is that it does not have the “cut” in its side indicating the catode terminal. The catode is shorter but if someday I cut them in the same size, it would be harder to tell which is which.
I bought a 5.1 V power converter that had a round connector. As I do not have a corresponding female connector, I decided to cut it off and solder some wires in order to be able to connect it to my breadboard.
Eventually I read a little more about soldering and realized this was not a good one :(. But at least it works!
Since I don’t have a hardware background, I have to start from the beginning.
This circuit get power from a 5 Volts power converter and use a 220 ohms resistor:
Of course, the power switch is optional :).
I used the Led Calculator to calculate the resistor’s value. I assumed this LED has 2 Volts of forward voltage at can take up to 15 mA.