Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Components for wireless controlled toy train?

Sand2silicon

New Member
I want to build a wireless controller, and a motorized toy train to run on wooden BRIO tracks to be remote controlled. The goal is a variation of this:
https://www.amazon.com/Accesories-Operated-Locomotive-Vehicles-Powerful/dp/B09WN4ZKKZ

Key Features:
Transmitter:
- 3 Throttle levers
- Independent / simultaneous control of up to 3 trains
- Forwards / Backwards and basic variable speed control for each train or (2-speed fast/slow).
- 2-4 buttons /switches for controlling future track switches or accessories.

Receiver / Toy Train:
- Wireless Receiver - receive signals for forwards/backwards and variable speed.
- if 2-speed fast/slow significantly simplifies things that's ok.
- Bonus: If the train could have 3 push buttons on top: Forwards / Stop / Backwards
- This would be in addition to the wireless control and offer a simplified on-board interface for the toddlers.

The goal is to make this as inexpensively and compact as possible. I'm not tied to any technology yet but the components I have in mind are below. I've messed with an Arduino but never done a project like this and am not sure what exact parts I need. Will some combination of these parts work, or is there a better alternative? How can I power the small train and it's components, and manage voltage?

Please help finalizing a design and component selection.

- Transmitter:
Raspberry Pi Pico W (to act as controller and transmitter)
- (or some Arduino?)

- Powered how, directly from 3xAAA ?

- Train / Receiver:
MOTOR:
- Diann 4pcs TT Motor DC 3-6V Gearbox Motor 200RPM Ratio 1:48
https://www.amazon.com/dp/B0BR7S2TRY/?th=1

RECEIVER PWM CONTROLLER
- ESP8266 ESP-12F - WiFi Serial Module Microcontroller 802.11N Module Wireless Transceiver
https://www.amazon.com/ACEIRMC-Microcontroller-Transceiver-Development-MicroPython/dp/B08Q3RC8T6/
or:
- ESP8266 NodeMCU CP2102 ESP-12E Development Board
https://www.amazon.com/dp/B081CSJV2V/

MOTOR DRIVER:
- DRV8833 Dual Motor Driver
https://www.amazon.com/HiLetgo-Stepper-Controller-Tb6612fng-Replace/dp/B00UYIFYCW/
https://www.amazon.com/WWZMDiB-DRV8833-Driver-Controller-Bridge/dp/B0DB8CX8LK
or:
- Mini L298N
https://www.amazon.com/WWZMDiB-Channel-Bridge-Electric-Projects/dp/B0BD53Q7TT/

POWER MGT
AMS1117-3.3 DC-DC Step-Down Power Module
https://www.amazon.com/HiLetgo-AMS1117-3-3-Step-Down-Module-AMS1117-3-3V/dp/B01HXU1NQY/
 
Last edited:
The ESP8266 (or ESP32) can act as either transmitter or receiver.

The approach would be to use sockets for the data exchange.

You code in Arduino C/C++ or use NodeRed or Tuniott or other block
languages that have that capability to create cleint/servers.


Regards, Dana.
 
I'd just use html client/server.
You can get vary fast response times for connection if you preload the server's MAC address into the client.

Make each train a server

Keep changing the MAC address when a button on the client is pressed to connect to the right train.

Associate each button with a different string for each request. Http://192.168.1.100/Button1

The train simply parses the http request to understand which string was sent - then do what you want the button to do. If request string=Button1 then down.
 
Just esp32's... These can be made into their own mesh network with the builtin peer to peer mesh
All on the web.. I had six all talking to a single node.. all done on the arduino IDE..
 
Just esp32's... These can be made into their own mesh network with the builtin peer to peer mesh
All on the web.. I had six all talking to a single node.. all done on the arduino IDE..
Yes, that's the part I left out on the html client server - use ESP32.
 
The ESP8266 (or ESP32) can act as either transmitter or receiver.

The approach would be to use sockets for the data exchange.

You code in Arduino C/C++ or use NodeRed or Tuniott or other block
languages that have that capability to create cleint/servers.


Regards, Dana.
Thank you all for the replies.

This link about micropython-sockets is a fantastic resource and forced me to think more clearly about the consequences of using full wifi instead of simpler RF. I'm not sure I want this toy and controller to be dependent on an existing network, let alone one that's hardcoded into the chip. I'm reconsidering going with another solution like 2.4Ghz RF.
 
Overall I'm less worried about the programming part, as I'm a programmer. My question is really, what's the right mix of hardware components to achieve my goal? Especially for onboard the train (the Rx end). The rough idea I have is based on conflicting responses from Microsoft Copilot and some very old forum posts. What I understand I need is (please correct me):

[transceiver/receiver] ---> [PWM Controller] ---> [Motor Driver] ---> [Motor]

If I instead go with a NRF24L01+ (or something similar), I'm hoping I could get either a Transceiver or a Motor driver that has an integrated PWM Controller and do it without a full microcontroller to cut down on the number of components needed onboard that little train.

I don't know if that is possible, but I find it hard to believe every cheap RC toy has a microcontroller onboard given the cost that adds. What are my options for solving this problem?
 
Last edited:
Thank you all for the replies.

This link about micropython-sockets is a fantastic resource and forced me to think more clearly about the consequences of using full wifi instead of simpler RF. I'm not sure I want this toy and controller to be dependent on an existing network, let alone one that's hardcoded into the chip. I'm reconsidering going with another solution like 2.4Ghz RF.
You misunderstand. The ESP32 can be set up in "station mode" where a server (on each train) creates the core of a stand-alone network (not connected to the web).

The client (also an ESP32) will connect to the appropriate train or switch or lamp or... as you push each button on the controller.

The cool thing about the ESP32, it's a full fledged microcontroller with ADC, PWM, various serial in/out and GPIO pins. The whole thing can be programmed easily using a range of libraries and example code.

You can add a "setup" button on the client to make it act as a server momentarily so you can connect with your phone or laptop to reprogram buttons or MAC addresses of connectable devices.
 
When I was looking into DCC for Hornby trains they used a dual opamp as the motor driver!
However! that IC is unobtainium now, it had 400mA switching and can drive a motor directly.

So I bought a quad and doubled the outputs giving roughly the same.
I used to have all the doc's but the controller was my mobile phone..


https://www.instructables.com/ESP8266-DCC-Controller/ using esp unit
 
Block programing, client server, station mode, ESP8266 and/or ESP32.


Attached a handy book on data exchange versus protocol.

Regards, Dana.
 

Attachments

  • NodeMCU.ESP8266.Communication.Methods.and.Protocols.Programming.with.Arduino.IDE.(z-lib.org).pdf
    5.1 MB · Views: 31
When I was looking into DCC for Hornby trains they used a dual opamp as the motor driver!
However! that IC is unobtainium now, it had 400mA switching and can drive a motor directly.

So I bought a quad and doubled the outputs giving roughly the same.
I used to have all the doc's but the controller was my mobile phone..


https://www.instructables.com/ESP8266-DCC-Controller/ using esp unit
Long ago the Maplin Magazine had a project for making DCC controllers using PIC's, but I can't remember what the motor drivers were?.
 

Latest threads

New Articles From Microcontroller Tips

Back
Top