Close

2016-07-20 motor control

A project log for Remote controlled LEGO DUPLO locomotive

Modifying a LEGO DUPLO locomotive to be able to go forward as well as backward, have some lighting, and be remotely controlled.

simon-fojtuSimon Fojtu 08/01/2016 at 19:220 Comments

I've made plenty of mistakes in the design of the receiver pcb. I've forgotten a pull-up resistor on RESET signal, but it seems it is not entirely necessary, since on a breadboard the attiny85 is running fine. I've forgotten the clamping diodes on the H-bridge, but again the breadboard version without them is running happily (it seems). Nevertheless, the diodes can be bodged to the transistors even without own footprints on the pcb. Hardware debouncing of the button is missing as well. It is not present on the original circuit so either the type of button used is not prone to bouncing or it is solved in software. In my breadboarding experiments it seems that a single 10uF electrolytic capacitor (the value and type were the first on hand) between the pin and ground get rid of all bouncing. If only the pin (PB2) was not SCK required for programming the chip. It seems the MCU wants its clock nice and straight and not filtered out :)

All in all it is a lovely endeavour and the breadboarded receiver (or rather a controller, since there is no signal to be received yet) is working well with all the interrupts and correct sleep modes. Short press makes the motor turn in one direction, long in the other, as desired.

Also, I've tried to use C++ in an embedded system, works like a charm.

Discussions