This coding dojo is inspired by Youtube channel Arduino Lego Trains and the site Internet of lego.
Raspberry Pi 3 Model B
Black = Ground (GND), Red = 5V (VCC), Yellow / Blue = Signal (GPIO / DI / DO)
GPIO = GPIO on Raspberry Pi
- 5V and ground connect to IR-remote (5)
- Power and signal cable for motor. 3-pole contactor to motor controller (4). Yellow to GPIO 25, Blue to GPIO 23 and 24
- Cabel to Lego motor. Connected to motor controller (4)
- Motor controller (Dual H Bridge Stepper Motor Drive Controller Board Module For Arduino L298N CF). Control for the gear motor. Supplies motor and IR-remote with 5V
- IR-remote (Infrared-led 5mm, 1.35v, 100ma, 925mm). Resistors for regulating the current. You can buy premade on eBay
- Photo resistor sensor module detector board
- Signal connects to GPIO22 and DI on IR-remote
Operating system used on the PI.
LIRC is need to controll the train with IR. Follow the instructions from Internet of Lego http://www.internetoflego.com/lego-train-automation-ir-power-functions-with-nodejs-and-lirc/
LIRC is a package that allows you to decode and send infra-red signals of many (but not all) commonly used remote controls.
LEGO Power Functions LIRC (Linux Infrared Remote Control) https://github.com/dspinellis/lego-lirc
The IR-remote is controlled with LIRC.
irsend LIST LEGO_Single_Output ""
irsend SEND_ONCE LEGO_Single_Output 1B_4
irsend SEND_ONCE LEGO_Single_Output 1B_BRAKE
http://www.toptechboy.com/raspberry-pi-with-linux-lessons/
https://github.com/alexbain/lirc_node
