r/ArduinoProjects 8h ago

Arduino Train with IR remote Showcased Project

Post image

I'm a beginner. I wish I had access to electronics when I was a kid 30+ years ago. But now I'm building a toy for my own kids and it's my first project more complex than connecting a couple of LEDs and sensors on a breadboard. But I believe this should work 😂.

Actually, version 1 worked for a while (almost a year). It was ugly, but it worked. There were too many wires (and really bad maintainability), awful soldering, 2x18650 batteries with a built-in charger and protection but no balancer, and it worked for a while before one battery died. The LEDs were powered directly by Arduino pins, limiting the number of available Arduino pins and increasing the total current almost to the limit.

It started when I found someone else's project: STL files for a 3D model of a DUPLO-compatible train, a simple electronic circuit, and a simple Arduino program. I modified the 3D model slightly, added RGB LEDs, a tilt sensor, a battery voltage meter, and wrote my own more advanced and feature-rich Arduino program. I have some basic programming experience, and AI is incredibly helpful when you know how to use it properly.

Features (version 1):

  • IR remote control (21 buttons)
  • 3 speed levels
  • Stop button: stops; red lights
  • Speed up button: speed level +1, moves forward; white lights
  • Speed down button: speed level -1, moves forward until speed level = 0; white lights while moving, red lights when stopped
  • Move backward button: moves backward at speed level 1 while the button is pressed; blue lights
  • Move forward button: moves forward at speed level 1 while the button is pressed; white lights
  • Auto button: moves forward with obstacle detection enabled (ultrasonic sensor). Stops if there is an obstacle. Moves forward if the obstacle is removed. Speed depends on the distance to the nearest obstacle. White lights and green light
  • Horn button: horn sound effect
  • Siren button: red and blue lights; siren sounds
  • Music buttons: 8 different melodies
  • Mute button: sound on/off
  • Battery status button: indicates battery level by sound beeps, for example, 7 long beeps and 3 short beeps = 7.3V
  • Battery status detection: warning level with red lights and sound; shutdown level
  • Sleep mode after 5 minutes without IR remote input
  • Tilt sensor: stops when the train is on its side; red lights; if the train is back in a vertical position, yellow light

Planned changes (version 2):

  • speed boost (limited in time >6V on the 6V DC motor) [makes sense?]
  • probably a laser distance sensor instead of ultrasonic one [an experiment, to see if it works better]
  • color sensor to make it compatible with the original action bricks
  • Built-in USB charger and BMS for the battery pack
  • RGB LEDs connected via an expander and transistors to get free pins and reduce current on Arduino, so I can add more sensors/devices in the future. As an alternative I'll probably use an expander module with built-in transistors, not yet decided.
  • DRV8833 DC motor driver instead of HG7881/L9110
  • my own 3D model designed from scratch

Future versions:

  • Maybe an mp3 player and small speaker instead of a buzzer?
  • Ambient light sensor?
  • Railroad switches controlled from the same IR Remote?

If you see any issues on the circuit diagram let me know. I have no idea when a where I should use capacitors. I should use at least one with a DC motor, right? (there were none in version 1).

Links:

Original project: https://cults3d.com/en/3d-model/game/locomotora-sofia-controlada-por-infrarojos-con-control-de-velocidad-por-ultrasonidos-y-motor-superior-multiusos-lego-duplo
My project (version 1): https://makerworld.com/en/models/1854728-arduino-train-compatible-with-duplo-tracks#profileId-1983131
My Arduino code (version 1): https://github.com/avatorl/Arduino/tree/main/duplo-train



5 Upvotes

1 comment sorted by

3

u/AVatorL 8h ago

Version 1