Having plenty of success using the esp32 but still have to get up to speed with ESP-NOW (see other posts).
So do you have the ArduinoIDE up and running and maybe already tried to compile and run some code on the esp boards?
I found more videos and articles I hadn't seen before on the details and explanations of single line control using tokens, tablets and staffs by using these key words in a google search.
"inner workings of an railway electric token machine"
The trick with a google search is the choice of key words.
Using four tiny magnets stuck at 90 degree around the tumbler and two hall effect sensors to detect the direction of rotation (like motor encoders do) the tumbler could use this logic.
if rotate clockwise then LOCK the storage entry
if rotate anti clockwise then UNLOCK the storage entry
Where a LOCK is really a BLOCK between the tumbler and storage.
Actually thinking about it, the act of rotating the tumbler clockwise could pull a mechanical switch to turn ON a solonoid to close the storage entry and rotating the tumbler anti clockwise could release the mechanical switch to turn OFF the solonoid to open the storage entry, no electric sensors required!
The electric signal to turn the solonoid ON or OFF would have to be sent to the other machine at the same time.
I suspect the real machines might work this way?
Having plenty of success using the esp32 but still have to get up to speed with ESP-NOW (see other posts).
So do you have the ArduinoIDE up and running and maybe already tried to compile and run some code on the esp boards?
No, I haven't had a chance to connect any hardware yet, but I have installed the Arduino IDE in preparation.
I found more videos and articles I hadn't seen before on the details and explanations of single line control using tokens, tablets and staffs by using these key words in a google search.
"inner workings of an railway electric token machine"
The trick with a google search is the choice of key words.
Remember, don't get too bogged down with how the real staff machines work. As you may have discovered, they have very complex electro-mechanical workings inside the machine.
Cheers,
Ian
Ian Millard
Port Macquarie, NSW, Australia
ESP32/Arduino etc novice
Using four tiny magnets stuck at 90 degree around the tumbler and two hall effect sensors to detect the direction of rotation (like motor encoders do) the tumbler could use this logic.
if rotate clockwise then LOCK the storage entry
if rotate anti clockwise then UNLOCK the storage entryWhere a LOCK is really a BLOCK between the tumbler and storage.
Actually thinking about it, the act of rotating the tumbler clockwise could pull a mechanical switch to turn ON a solenoid to close the storage entry and rotating the tumbler anti clockwise could release the mechanical switch to turn OFF the solenoid to open the storage entry, no electric sensors required!
The electric signal to turn the solenoid ON or OFF would have to be sent to the other machine at the same time.
I suspect the real machines might work this way?
There really is no room inside the head for me to mount another servo or solenoid at the storage entry. The current tumbler lock mechanism is really the only option.
Also remember, that when returning/inserting a staff, the tumbler cannot be unlocked prior to the correct staff being "detected" by the momentary switch, hence if the switch is placed correctly, an incorrect staff will not be able to be moved close enough to the tumbler to trigger the switch, but a correct staff will.
I probably won't have much time to continue with the project over the next couple of weeks as there is a lot of "life stuff" going on at the moment! 😀
But I want to keep the momentum going, so come mid September, I should be in a position to start wiring up the hardware and playing with some test sketches.
Cheers,
Ian
Ian Millard
Port Macquarie, NSW, Australia
ESP32/Arduino etc novice
I am not getting bogged down, I like understanding complex machinery 🙂 Understanding how the real machines worked was of personal interest independent of your project and I would really like to know. I did get that you just wanted the functionality.
You did ask for ideas but I understand that you probably just want the code to work with how you have already decided to go about the task which is fine by me. However independent of that I can't stop myself thinking about simpler solutions.
For me it hasn't been a waste of time, indeed the opposite, it has been an excuse to get up to speed with the esp32.
So when you are ready to make the next step just post. When (if?) I get it working in the meantime I will post the result.
Cheers,
John
I am not getting bogged down, I like understanding complex machinery 🙂 Understanding how the real machines worked was of personal interest independent of your project and I would really like to know. I did get that you just wanted the functionality.
You did ask for ideas but I understand that you probably just want the code to work with how you have already decided to go about the task which is fine by me. However independent of that I can't stop myself thinking about simpler solutions.
For me it hasn't been a waste of time, indeed the opposite, it has been an excuse to get up to speed with the esp32.
So when you are ready to make the next step just post. When (if?) I get it working in the meantime I will post the result.
Cheers,
John
Thanks John.
I hope I didn't come across as ungrateful for your input so far, that's far from it.
I suppose I've just had it in my head what I wanted. I know I said I was open to all ideas and that's still the case, it's just, as I mentioned, I have limited space inside the 3D printed head for any extra hardware other than the two servos already mentioned.
I am so much of a novice at this coding stuff, it's not funny, but I realise that once I have code from yourself, and along with Tim's, I'll need to have some basic understanding of how it works, which I can see will be a steep learning curve for me.
Keep plugging away!
Cheers,
Ian
Ian Millard
Port Macquarie, NSW, Australia
ESP32/Arduino etc novice
I am so much of a novice at this coding stuff, it's not funny, but I realise that once I have code from yourself, and along with Tim's, I'll need to have some basic understanding of how it works, which I can see will be a steep learning curve for me.
Well, I should be able to provide a high-level, walkthrough of my code for a reference. (I don't need the circuit for that.) I'll try to write it up as a single post over the next week or so, as time permits.
@imillard, FYI @robotbuilder, @huckohio
Attached is the METS v.0.2.4 walkthrough html file. It should be a helpful reference.
It is unclear to me to what extent you are interested in coding. Your interest is in train models and I guess your electronic know how comes from that. What you do need to know is how to compile and load the code written by @tfmccarthy or anyone else onto your esp32 boards to see if it does what you want.
I now have working code using the ESP-NOW library to exchange info between two esp32 boards so should soon have a working hardware example similar to that used by @tfmccarthy.
It is unclear to me to what extent you are interested in coding. Your interest is in train models and I guess your electronic know how comes from that. What you do need to know is how to compile and load the code written by @tfmccarthy or anyone else onto your esp32 boards to see if it does what you want.
I now have working code using the ESP-NOW library to exchange info between two esp32 boards so should soon have a working hardware example similar to that used by @tfmccarthy.
Thanks John.
I have a basic understanding of electronics and can definitely connect LEDs, resistors etc on the breadboards to build a circuit. To be honest, I was prepared to learn coding, but it seems it might be a steep cliff for me. Looking at Tim's explanation document, a lot of that is just over my head, but I realise that I need to have a basic understanding what the code does. I think I'll be OK to compile and load any code. I hope to have a go at some basic sketches and loading them onto the boards to try and get my head around the basics.
Thanks again for all you have done and I look forward to seeing what you have come up with.
Cheers,
Ian
Ian Millard
Port Macquarie, NSW, Australia
ESP32/Arduino etc novice
I think I'll be OK to compile and load any code.
Well I don't know how to compile and load Tim's code.
Although in the past I have spent time learning C++ and found it very hard and frustrating when I couldn't do simple things like getting a graphics library to work with it. I am kind of limited to C++ console programming (TEXT I/O ONLY) with those tools.
ArduinoC++ and the Arduino IDE are much simpler to use and come with links to libraries to do things like turning the pins on/off and setting pin functions in the microcontroller along with lots of other easy to use functions and easy to install libraries.
Even if you decide coding is not for you, as I wrote earlier, you will have to know how to load and compile other people's programs into the esp32 board using the Arduino IDE.
Until your project gave me an excuse to learn how to use the ESP_NOW library I hadn't actually programmed the esp32 as my other projects all used the Arduino UNO and Mega boards.
So I suggest you jump right in and get the button/led program working on the esp32 board and that will be all you need to know to load my esp32 programs.
https://dronebotworkshop.com/esp32-intro/
Note the touch inputs. They might be all you need instead of your physical toggle switch!!
"The small gold square in the diagram is a Touchpad. You can use any metallic object that you can connect a wire to, a small piece of PCB would work great. I just used a small piece of bare wire on my breadboard."
Well I don't know how to compile and load Tim's code.
Let's fix that.
You should have folder named METS that has all the files (dbws.h, METS.h, METSmac.h, METS.cpp, and METS.ino)
You should then be able run the Arduino IDE and open the METS.ino sketch file.
You set the board to the ESP Dev Module. You can select the COM port but don't have to if you just want to compile the sketch.
(Note that you can connect the sketch to a ESP32 without the supporting circuit. The sketch will run but won't do anything and just sits in the IDLE state.)
EDIT: D'oh! You will see the banner message, but you won't pass the sensor check code.)
You need to insure the ESP32 board is version 2.0.16. This is the highest version I could run both Bill's ESP32-NOW sketch and METS. I wanted to maintain compatibility with Bill's code so that others could replicate both sketches.
You should now be able to successfully compile the METS sketch. If you upload it to an ESP32 it should run, and you should see the banner message in the Arduino Serial Monitor.
Let me know if you're successful.
If there are problems, I'm blaming someone else. 🙂
ESP32s typically draw about 160-240mA each when active, so your power supply should be able to handle two of them without any issues.
Here's a summary of what I've found so far, and some basic modelling ideas -
Miniature Electric Train Staff
My deductions of the Operating Principles -
The staffs have 4 guide rings and 4 possible 'key' ring positions. They are constructed as 'long rod end with section name, Ring1, key1, key2, Ring2, centre rod, Ring3, key3, key4, Ring4, short rod end'.
Often a large conventional key would be added to the short end to allow ground frames to be unlocked for a remote siding or at a distant entry to a station precinct siding.
Keys 0000 & 1111 are NOT used, but these are possible -
00-01 00-10 01-00 10-00
01-01 10-10 10-01 01-10 <-- these 4 are seen most often
00-11 01-10 11-00
01-11 11-10
Where multiple trains were travelling in the same direction special staffs that unscrewed at key2-Ring2 and Ring3-key3 provided 1 or 2 'Tickets' with the centre, 2 ringed section being the group's Staff that travelled in the last train to leave (and arrive).
Staffs are physically stored in narrow vertical storage racks in the base of each machine with the wider rings securing them.
The 2 electrically linked machines at each end of a track block have rotating drums with 4 notches 90° apart that are shaped to only accept the staff key shape for that track block. A lock bar has to be lifted to allow clockwise rotation, but anti clockwise is always possible because a cam on the drum lifts the lock when a staff is being returned to either machine.
Reasons for returning a Staff to the same machine include engine failure, track damaged mid block, urgent movement required from other end before departure (eg medical emergency), etc.
Each quarter turn of the drum in either direction operates a polarity reversing switch, thus every extraction or insertion of a correct staff will put a machine in or out of polarity phase with the other machine. A second polarity reversing switch keeps the signals for the local 'Bell' sounder and telephone correct at all times.
To get a staff out, two 120mA electromagnets in concert are used to lift a locking bar against a calibrated spring. One electromagnet is powered from a local battery bank when the local Bell/Staff switch is turned to 'For Staff' . The other electromagnet is powered from the machine at the other end of the track block with a return path through the 'earth'. A somewhat higher volage is required to make up for line losses but this is easily adjusted with regular testing.
The remote power comes through the 'Line' connection between the machines when the remote operator holds down his telegraph key in response to a request by the local operator, it passes through the polarity reversing switch, a contact in the Bell/Staff switch, a galvanometer, the second electromagnet, then to earth. If the 2 machines are 'in phase' the lock will release allowing a clockwise rotation and a staff can be withdrawn, otherwise no staff out.
As the staff is withdrawn it reverses the Line in polarity so the locking bar is pulled in by the spring, however cams on the rotating drum allow a full 90° turn before the drum actually gets re-locked. The sudden change in polarity makes the galvanometer needle jump, so the remote operator knows to release his key and move the Staff In/Out indicator to Out. The local operator should move their indicator too.
To put a staff in to either machine the drum has additional cams that will lift the locking bar when the drum is turned a little anti clockwise. Thus when unpowered, staffs can be pulled down the curved guide. The polarity switch on that machine will be changed and both machines will then be back 'in phase' to allow a withdrawal from either end. It is polite practice to telegraph the other end when returning a staff, but most railways made it compulsory so that the Staff In/Out indicators were set correctly.
Later machines had additional circuitry to automatically set the Staff In/Out indicators.
Modelling ideas (see attached diagram) -
Once a suitable size is determined then a drum can be made from hardwood with the ring groves all the way around and 4 slots added. A smaller circle can be carved into 4 cam lobes and glued (at any desired orientation) to one end. This can then be mounted to an axle in a box which has slots and holes to allow Staff withdrawal and return.
2 micro switches and an Electromagnet then need to be correctly positioned to detect Staff movement and simulate operation of the machine. 2 momentary switches are also required on each machine. Once the mechanics are sorted then external covers can be added to make it look the part.
An external Bell sounder (electromagnet) should also be supplied for each machine and a Set-State button and indicator LEDs added for each Track Block before painting and decorating.
Operation is quite simple with the aid of some modern electronics -
1 micro controller (such as an Arduino Nano) handles 2 machines per Track Block.
At startup press each set-state button until the desired state for each Track Block is shown via 2 LEDs - None = Staff In, LED1 = Staff Out from 1, LED 2 = Staff Out from 2, both = Error. Set the manual indictors on each machine to the set state.
If any telegraph key is pressed while a Track Block state is 'Staff In', ring the opposite bell for that Track Block, then the local bell in the correct sequence of codes to allow a Staff to be Withdrawn. When the Staff is lifted past a micro switch wait till the local 'Bell In/Staff Out' switch is pressed before operating the Cam Release/Galvanometer display with an Electromagnet. Wait for the Drum position micro switch to signal finished. Turn off the Electromagnet, update the state, ring confirmation codes.
If no Staff is withdrawn within 10s, return to the 'Staff In' state. (Note the 6V (nominal) electromagnets are not rated for continuous operation: 30s max 'hold' time.
Both machines should then have their manual Staff In/Staff Out indicators changed.
For more realism have random variations in the speed of each operator's Key presses and occasions where the operator is busy doing something else so there is no answer and you have to try again.
Some partial code examples to follow (soon) ...
bye for now
Essentially that is how I read the workings of the actual machines.
However @imillard wants a wireless connection so no wires to communicate or reverse polarity on.
The other issue is the drum in Ian's design is what it is so unless the drum is redesigned it is free to rotate in any direction unless the locking rod is moved into place by software that controls the stepper motor.
He is not duplicating the original machine's mechanisms (apart from the coded staff key and drum) only its functionality.