Help required for m...
 
Notifications
Clear all

Help required for model railway project

280 Posts
10 Users
14 Reactions
11.2 K Views
byron
(@byron)
No Title
Joined: 6 years ago
Posts: 1194
 

@imillard

Just to add my own small contribution to helping what is probably an urge to tear another bit of hair from the bonce, dont forget that these microcontroller boards have a limited power output capacity and and even more reduced capacity for each pin.  This comes very much into focus when driving motors of any sort.  So not only does one have to make sure the voltage output of the board is match to the requirement, but also the current.  Driving servo board is often done by using a servo driver board such as 

https://thepihut.com/products/adafruit-16-channel-12-bit-pwm-servo-driver-i2c-interface-pca9685

and the microcontroller communicates to the board via i2c.  Depending on the servo motors you use, you are probably ok for one or two motors, but if you eventually get to wanting to power a bunch as maybe will be the case for a future railway sidings project, then keep this in mind.

And I see that in a previous post @davee gave you a Random Nerds link on what pins you could use for output on the Wemos ESP8266 mini which show 7 easily usable pins.  That should be plenty for your staff control project so you could easily choose to use that board if you wish.

 


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 6 years ago
Posts: 2268
 

@byron  FYI @imillard

... dont forget that these microcontroller boards have a limited power output capacity and even more reduced capacity for each pin.

Which of course is why the microcontroller should only be seen as providing the control signals to the devices circuitry not the driving power for any connected device. Their grounds however need to be connected to return the signal current back to the microcontroller. The power pins +5 and GND on the esp32 do appear to be sufficient as a power source for two small 5v servos. I saw in one example one servo using the 3.3v pin. However the power drawn from these pins must have some limit which may be exceeded as more devices are connected.

The microcontroller does the "thinking" and the less power it uses the better.

Another addition I have see added to a servo connection is the use of an electrolyte capacitor to absorb any voltage spikes to prevent erratic behaviors.

 


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 6 years ago
Posts: 2268
 

@imillard

If I had the WeMos D1 Mini1 I would probably try and upload the code to see if it supported ESP-NOW and try and find some pins that worked.

WemosServo

I have seen the esp32 cam board using two small servos to drive the turret for the camera.

esp32 cam

 

 


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 6 years ago
Posts: 2268
 

@imillard

It seems you can use ESP-NOW.

Maybe you just have to choose from the available pins and change the includes and pin setup.

https://randomnerdtutorials.com/esp-now-esp8266-nodemcu-arduino-ide/

 


   
ReplyQuote
(@bruceg)
Member
Joined: 5 months ago
Posts: 8
 

Hi @imillard,

If you do decide to re-do the METS Instument internals perhaps you should use the modifications that NSWGR made to it.  Instead of the Drum 'proving' the Staff they added a guide and finger plate between the In/Out hole and the Drum.

METS Simplified Staff 'Prover'
METS with Australian Key Plate

To fit the new guide and finger plate they simply milled away some of the side of the Instrument, then drilled and tapped 2 bolt holes.  The second attachement show a 'C' Finger Plate on the side of a NSWGR modified METS Instrument.

The drums were much cheaper to make, and changing the Staff pattern was just a 5 minute job.

bye.

This post was modified 4 months ago 2 times by bruceg

   
ReplyQuote
imillard
(@imillard)
Member
Joined: 7 months ago
Posts: 87
Topic starter  

Posted by: @bruceg

Hi @imillard,

If you do decide to re-do the METS Instrument internals perhaps you should use the modifications that NSWGR made to it.  Instead of the Drum 'proving' the Staff they added a guide and finger plate between the In/Out hole and the Drum.

-- attachment is not available --
-- attachment is not available --

To fit the new guide and finger plate they simply milled away some of the side of the Instrument, then drilled and tapped 2 bolt holes.  The second attachment show a 'C' Finger Plate on the side of a NSWGR modified METS Instrument.

The drums were much cheaper to make, and changing the Staff pattern was just a 5 minute job.

bye.

Hi @bruceg,

I have actually implemented this on the model.  The "finger" plate you refer to is actually called a "staff gauge plate".  My drum now becomes a "universal" drum and the gauge plate does the proving of the staff as you mentioned.  It wasn't that much of an alteration to my drawings

Thanks.

Ian

 

Ian Millard
Port Macquarie, NSW, Australia
ESP32/Arduino etc novice


   
ReplyQuote
(@bruceg)
Member
Joined: 5 months ago
Posts: 8
 

Hi @imillard,

Are you aware of esp_wifi & ESP_NOW_Serial ?

These provide additional functionality and simplify comms.

esp_wifi allows specifying wireless parameters, especially if done under promiscuous mode.  Settings made PRIOR to calling esp_now_init(); will be applied by it; this includes selecting wireless channel or bandwidth limiting.

ESP_NOW_Serial allows structured data or plain string data to be exchanged in the same way as USB comms 'talks' with a PC serial terminal.

Together they make the ESP_NOW system easier to use.

See - https://wolles-elektronikkiste.de/en/esp-now-serial

bye.

This post was modified 3 months ago by bruceg

   
ReplyQuote
imillard
(@imillard)
Member
Joined: 7 months ago
Posts: 87
Topic starter  

Posted by: @bruceg

Some info about mixing motor and data power.  Don't !  (That was a bit harsh 😉)

But you can use a single power supply - IF you separate each power using group with a one-way isolating diode and a local power storage capacitor.  A 1N4002 (2A) diode into a 25V 100uF capacitor is usually all that is needed to prevent interference and brownouts causing glitches and resets.  And it will ensure motors have maximum torque available each time they start turning.

Why a 25V capacitor for a 3.3/5V system ?  Plain DC motors and electromagnets store power in magnetic fields while in use.  When turned off that magnetism collapses back into an uncontrolled voltage spike that should be steered through a 'fly-back' diode into the local storage capacitor (and blocked from the other systems by the isolating diode).

@bruceg

Some time ago, you posted the above suggestion regarding separating power supplies to servos and the ESP32 using a capacitor and diode.

I think I know what you are talking about, but could you provide a schematic showing how the 'fly-back' and 'isolating' diodes are connected in the servo power supply circuit?

Cheers,

Ian

 

Ian Millard
Port Macquarie, NSW, Australia
ESP32/Arduino etc novice


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 8047
 

@bruceg Excellent information, I was unaware of that mode of using ESP NOW. Thanks.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@bruceg)
Member
Joined: 5 months ago
Posts: 8
 

@imillard 

Here's the basic schemes -

DC Power Isolation

You use largish plain diodes for isolation and fast acting shottky diodes for spike diversion.

Where loads are high and/or intermittent, provide an adequate capacitor reservoir, rated for at least twice the operating voltage so that spikes won't damage it.

Servo motors benefit from being supplied adequate voltage from close by, in fact a nominal 5V servo works best at about 6.25V (the internal drivers prevent the motor voltage getting back to the control signal source).  1 or 2 Servo motors can be run from the capacitive reservoir on-board a buck converter, but when more are run from a single converter add more storage to avoid voltage droop.  I recommend to NEVER run servo or stepper motors and a microcontroller with unisolated supplies.

bye.


   
imillard reacted
ReplyQuote
Page 19 / 19