Welcome to the forum   
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Share
Options
View
Go to last post in this topic Go to first unread post in this topic
Offline Markus Schild  
#1 Posted : 29 June 2014 19:14:43(UTC)
Markus Schild

Germany   
Joined: 14/01/2006(UTC)
Posts: 1,802
Location: Wurttemberg
Hi,

Many modellers and enthusiasts still use the old – style Märklin turntable 7186 (aka 7026 / 410 N).

I was always bored by the control with the two knobs. If you want to turn from position 1 to 5 you must observe the turntable all the time and wait until it stops at every position just to start it again.

My aim was to build a replacement for the old two – knob device with a numeric control without any modification of the turntable itself. The control device only works with turntables in good condition. If the bridge has contact- problems these problems must be solved first.


Video:


http://youtu.be/OqSXKjg1Vvk


Layout:
UserPostedImage

Large scale version of the layout:

https://dl.dropbox.com/s/blw1h9knxbh7fg8/dreh300.jpg

All parts used can be bought from China for less than 25.00 EUR.

You need

Hardware (all ebay links just as a sample. I don’t have any preference for any of the sellers):





Software:


The most import part is the current sensor: It notices when the bridge has reached a position and triggers the restart.

When the sketch is installed the first time the EEPROM could contain an invalid value for the position. After installing the sketch the keys [ * ][ 0 ][ # ] must be pressed to rewrite the start-position.
At the initial start the turntable should be in the position between 0 and 7 like on the sketch below. On pressing one of the keys [ 0 ]-[ 9 ] it rides to according position. As a first test the key [ 1 ] should be pressed. If the bridge does not travel in the right direction to reach rail 1 in the shortest way, the red and green connections on the turntable must be swapped.
If the position is equal to the key pressed the loco is turned 180°.
If something is mismatched with the position of the bridge, pressing [ * ] <number of the rail> [ # ] overwrites the position in the memory according to the position chosen. In this programming mode a LED near the USB-port flashes rapidly.
If the key [ * ] is pressed by mistake, pressing [ * ] again leaves the programming mode.

Regards

Markus

Latest version 08/2016: https://dl.dropbox.com/s...sob8t/drehscheibe430.ino

Edited by user 21 December 2016 10:25:07(UTC)  | Reason: Restored lost code

thanks 28 users liked this useful post by Markus Schild
Offline Renato  
#2 Posted : 29 June 2014 20:02:26(UTC)
Renato

Italy   
Joined: 19/03/2004(UTC)
Posts: 976
Location: Gorizia, Italy
Hi Markus,

Fantastic!

I am just starting using Arduino and this is a very cool project.

Cheers

Renato
Offline matiasdc  
#3 Posted : 01 August 2016 01:35:37(UTC)
matiasdc

Argentina   
Joined: 01/08/2016(UTC)
Posts: 4
Location: Ciudad Autonoma de Buenos Aires, Buenos Aires
Hi excellent project, i am buy things to do it, but i can´t download the codification for the arduino, it isnt in the server, someone could help me please??, thanks!
Offline ixldoc  
#4 Posted : 01 August 2016 03:07:03(UTC)
ixldoc

Australia   
Joined: 18/11/2015(UTC)
Posts: 220
Location: Brisbane,Australia
Hi Markus,
Great idea! Always nice to modify an item to improve the function.
Can I ask ( as I am not able to code), does the solenoid drop in between tracks but is immediately re-energised to keep the bridge moving to the selected one? Also is that what the current sensor detects?
Regards,
Howard.
Offline Bigdaddynz  
#5 Posted : 01 August 2016 09:31:01(UTC)
Bigdaddynz

New Zealand   
Joined: 17/09/2006(UTC)
Posts: 18,661
Location: New Zealand
Originally Posted by: Markus Schild Go to Quoted Post
drehscheibe401.zip (2kb) downloaded 274 time(s).


It seems like this file has disappeared - I get a message when trying to download "Error: Resource has been moved or is unavailable. Please contact the forum admin."
Offline Markus Schild  
#6 Posted : 01 August 2016 12:03:56(UTC)
Markus Schild

Germany   
Joined: 14/01/2006(UTC)
Posts: 1,802
Location: Wurttemberg
Originally Posted by: ixldoc Go to Quoted Post

Great idea! Always nice to modify an item to improve the function.
Can I ask ( as I am not able to code), does the solenoid drop in between tracks but is immediately re-energised to keep the bridge moving to the selected one? Also is that what the current sensor detects?



Hi Howard,

Here is the latest code: https://dl.dropbox.com/s...sob8t/drehscheibe430.ino

The current sensor detects if the motor is running: If the motor stops, the next position is reached and the program decides if it needs to restart the bridge by putting on the solenoid for 500 ms. In most cases also 250 ms work fine. This must be tested with the turntable used.

Regards

Markus

Edited by user 21 December 2016 10:24:24(UTC)  | Reason: Not specified

thanks 3 users liked this useful post by Markus Schild
Offline patrick5678  
#7 Posted : 20 December 2016 21:23:40(UTC)
patrick5678

Germany   
Joined: 20/12/2016(UTC)
Posts: 1
Location: Nuremberg, Bavaria
Hi Markus,

Awesome project. Got all the material together, but my 7186 still needs a make-over.

Studying the code: What is button A's (ziel = 17) function? I do not really understand turn=0, turn=1, turn=2.

Many thanks for your help and sonnige Grüße aus Bayern.
Patrick

Code:


 if (ziel == 17) {
      turn = 1;
    }

// other code

if (turn == 0) {
            auftrag = schritte;
            Serial.println("kein turn");
          }

          if (turn == 1) {
            Serial.println("turn 1 erkannt");
            Serial.println(schritte);
            if (schritte > 0) {
              Serial.println("schritte groesser null");
              schritte = schritte - 8;
              Serial.println(schritte);
              auftrag = schritte;
              turn = 0  ;
            }
          }
          if (turn == 1) {
            Serial.println("turn 2 erkannt");
            Serial.println(schritte);
            if (schritte < 0) {
              Serial.println("schritte kleiner null");
              schritte = schritte + 8;
              Serial.println(schritte);
              auftrag = schritte;
              turn = 0  ;
            }
          }
Offline Markus Schild  
#8 Posted : 21 December 2016 10:27:44(UTC)
Markus Schild

Germany   
Joined: 14/01/2006(UTC)
Posts: 1,802
Location: Wurttemberg
Hi Patrick,

That was an error. That version was not intended to be published. I changed the links above to a valid version.

Regards

Markus
Offline JWS  
#9 Posted : 06 January 2019 10:11:24(UTC)
JWS

Netherlands   
Joined: 06/01/2019(UTC)
Posts: 4
Location: Zuid-Holland
Hi Markus,
I am new here, a dutchman in his sixties, who has started again, and found an old turrntable on ebay, and managed to copy your arduino scheme to run the turntable. Thank you for your scheme!! As I am using (the IB for) digital controle, I wonder if I could "easily" incorporate the arduino keyboard in the digital system (with turnoff decoder?) and nessesarily (?) changing of the (brown) mass connection of the turntable motor.
I just want to thank you again and will start searching this forum for the answers on my questions.
Greetings,
Jan Willem
thanks 2 users liked this useful post by JWS
Offline Markus Schild  
#10 Posted : 06 January 2019 22:47:52(UTC)
Markus Schild

Germany   
Joined: 14/01/2006(UTC)
Posts: 1,802
Location: Wurttemberg
Hi Jan,

Welcome to the forum. Yes, I thought about integrating it to a digital environment. But I have no ready to use solution so far.

Regards

Markus
Offline JWS  
#11 Posted : 11 January 2019 22:58:16(UTC)
JWS

Netherlands   
Joined: 06/01/2019(UTC)
Posts: 4
Location: Zuid-Holland
Hi Markus,
There must be a way to replace the 4x4 keyboard entries by a decodertype like k83 or a digikeys decoder? Iam no expert on this, maybe someone else on the forum?
Cheers,
Jan Willem (double first name)
Offline DaleSchultz  
#12 Posted : 12 January 2019 18:23:59(UTC)
DaleSchultz

United States   
Joined: 10/02/2006(UTC)
Posts: 3,997
Originally Posted by: JWS Go to Quoted Post
Hi Markus,
There must be a way to replace the 4x4 keyboard entries by a decodertype like k83 or a digikeys decoder? Iam no expert on this, maybe someone else on the forum?


yes, that is certainly possible to use the output of a K84 type decoder as an input to an Arduino type device. Treat the k84 as an input switch, connecting GND with an input pin.

For people who have access to the code of their layout software, I am also extending my RemoteSign syntax to drive network connected devices. I already have it at the point where I can do things such as trigger events, dim lights in the layout room, etc., from my train control software. I need to merge the documentation for the new RemoteSign commands into the SDK and also publish the RemoteSign library so that people can add it to their Arduino sketch and start calling it.

If you also use Blynk, and can issue HTTP calls from your layout software, then you can use their restful HTTP calls to trigger anything in your sketch.

Dale
Intellibox + own software, K-Track
My current layout: https://cabin-layout.mixmox.com
Arrival and Departure signs: https://remotesign.mixmox.com
thanks 3 users liked this useful post by DaleSchultz
Offline Markus Schild  
#13 Posted : 13 January 2019 08:52:40(UTC)
Markus Schild

Germany   
Joined: 14/01/2006(UTC)
Posts: 1,802
Location: Wurttemberg
Hi,

Just to describe my thoughts. This is all theoretically. It is not more than vaporware. And so far, I don't know whether I will realize it.


There is no MM-decoder with +10 functions. Using function decoders will work theoretically but will use a bunch of decoders and addresses. This will work but will be practically unusable.

I think about using an older decoder for locomotives. A MM decoder has 14 or 27 steps for the speed. These steps are realized as a pulse-wide modulation which power the motor. But these steps (the length of the pulses) could be also read by the Arduino. So, the knob on the control unit could become the control-device for the turntable.

Example: If the address of the decoder is chosen at the control-unit and the knob is turned to minimum speed for more than 3 seconds (to make the command valid), the decoder sends a pulse of X milliseconds (speed step 1) this could be interpreted as a command to turn the bridge to position A. A pulse of Y milliseconds (speed step 2) could be interpreted as a command to turn to position B. And so on. This would be at least useable also without a computer and needs only one decoder.

Foreseeable disadvantage: Due to different characteristics of different decoders this will work only with a specified decoder. Mabe only with a special decoder from one series.

Regards

Markus
thanks 3 users liked this useful post by Markus Schild
Offline Purellum  
#14 Posted : 13 January 2019 10:44:04(UTC)
Purellum

Denmark   
Joined: 08/11/2005(UTC)
Posts: 3,498
Location: Mullerup, 4200 Slagelse
Cool

Originally Posted by: Markus Schild Go to Quoted Post
There is no MM-decoder with 10 functions. Using function decoders will work theoretically but will use a bunch of decoders and addresses. This will work but will be practically unusable.


If you use a M83 decoder, you can use 7 of the outputs to count binary to 127, and use the 8th. output
to tell the Arduino when to read the binary number, to be sure you're not sending a lot of numbers while the M83 switches.

Per.

Cool
If you can dream it, you can do it!

I, the copyright holder of this work, hereby release it into the public domain. This applies worldwide.

In case this is not legally possible:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.

UserPostedImage
Offline JWS  
#15 Posted : 13 January 2019 23:04:39(UTC)
JWS

Netherlands   
Joined: 06/01/2019(UTC)
Posts: 4
Location: Zuid-Holland
Thank you Daele, Markus and Per, but I am afraid this is too much for me, at least at the moment. Iam thinking more to use simpel relais to connect the wires the same way when you push the matrix board. For the time being I only use gates 4,5 and 6 for the locdepot and opposite gate 8 to enter and leave the turntable. So 4 contacts to make, like 2 turnouts on a K83 but then with minirelais.......
Greetings,
Jan Willem
thanks 1 user liked this useful post by JWS
Offline TheesW  
#16 Posted : 17 March 2019 15:22:17(UTC)
TheesW

Germany   
Joined: 17/03/2019(UTC)
Posts: 2
Location: Berlin, Berlin
Hi,

thanks for posting this. I am struggling though to get it to work. I build it using your plan and uploaded the arduino sketch. The current measurement does not seem to work. Ampere is always sampled at around 18182.00 with or without load. Do you have any hint where to start investigating?

Greetings from nothern germany Confused
Offline Markus Schild  
#17 Posted : 18 March 2019 06:53:20(UTC)
Markus Schild

Germany   
Joined: 14/01/2006(UTC)
Posts: 1,802
Location: Wurttemberg
Hi,

That value is so far out of range that my only idea is, that there is something wrong with the ACS712 module itself or with the wiring. Also the power-supply for the module should be checked. Does the value change when you disconnect the module?

Regards

Markus
Offline TheesW  
#18 Posted : 19 March 2019 19:55:48(UTC)
TheesW

Germany   
Joined: 17/03/2019(UTC)
Posts: 2
Location: Berlin, Berlin
Originally Posted by: Markus Schild Go to Quoted Post
Hi,

That value is so far out of range that my only idea is, that there is something wrong with the ACS712 module itself or with the wiring. Also the power-supply for the module should be checked. Does the value change when you disconnect the module?

Regards

Markus


Hi,

My multimeter reads 550mA when the turntable is turning.

I simplified my setup to find the error and left only the ac712 on pin A2 and made a simple test sketch. analogRead will return values between 250 and 260. If I connect the AC712 without a load attached analogRead returns 876.00 constant. Putting a load on the ac712 does not change the value. I tried two different ac712 modules from two different suppliers already. I also checked if my arduino works correct. If I connect the 5V or 3.3V pins to an analog pin anlaogRead returns the expected values.

The high value from my first post is the result of this code I copied from the sketch you posted:
Code:
            ampere = 0 ;

            for (int i = 0; i < 50; i++) {
              ampere = ampere + (abs(analogRead(A2) - 512));

              delay(1);

            }


:-(
Offline DaleSchultz  
#19 Posted : 19 March 2019 20:09:19(UTC)
DaleSchultz

United States   
Joined: 10/02/2006(UTC)
Posts: 3,997
and do you divide the result by 50?
Dale
Intellibox + own software, K-Track
My current layout: https://cabin-layout.mixmox.com
Arrival and Departure signs: https://remotesign.mixmox.com
Offline Markus Schild  
#20 Posted : 20 March 2019 18:47:55(UTC)
Markus Schild

Germany   
Joined: 14/01/2006(UTC)
Posts: 1,802
Location: Wurttemberg
Hi,

So far I have no good idea what's going wrong here. I made about eight of these circuits for other people and all work fine with the code above. I will build another one to check the issue (mine is installed unreachable in the layout) but this will take some days.

Just one other idea: Do you use real AC from a real transformer? Or current from a switching power supply?

Regards

Markus
Offline chucky1983  
#21 Posted : 26 March 2019 18:21:54(UTC)
chucky1983

Germany   
Joined: 14/03/2019(UTC)
Posts: 2
Location: Schalkholz; Dithmarschen
Guten Abend. Ich habe eine Frage bezüglich des ACS712.... Wenn ich das auf dem Bild richtig sehe, denn kommt vom Trafo das gelbe Kabel, geht an + und - vom ACS712 und zum 2-Relais-Karte auf den jeweiligen mittleren Anschluß. Ist das so korrekt? Habe mir die ganzen Teile bestellt und warte nur noch auf 2-Relais-Karte und auf ACS712...
Mit freundlichem Gruß
Torsten Janner aus Deutschland
Offline Webmaster  
#22 Posted : 26 March 2019 21:10:04(UTC)
Webmaster


Joined: 25/07/2001(UTC)
Posts: 11,161
Translated by Google for the non-Germans:

Good evening. I have a question regarding the ACS712 .... If I see that in the picture correctly, because the transformer comes from the yellow cable, goes to + and - from the ACS712 and the 2-relay card on the respective middle connection. Is this correct? I ordered all the parts and just wait for 2-relay card and on ACS712 ...
Sincerely
Torsten Janner from Germany
Juhan - "Webmaster", at your service...
He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Old Chinese Proverb]
Offline chucky1983  
#23 Posted : 26 March 2019 21:18:14(UTC)
chucky1983

Germany   
Joined: 14/03/2019(UTC)
Posts: 2
Location: Schalkholz; Dithmarschen
Thanks for the translation. My Chrome Browser automatically translates English into German
thanks 1 user liked this useful post by chucky1983
Offline Markus Schild  
#24 Posted : 27 March 2019 08:07:05(UTC)
Markus Schild

Germany   
Joined: 14/01/2006(UTC)
Posts: 1,802
Location: Wurttemberg
Hi Torsten,

Only the current for the right relay is monitored by the ACS712. Look for the "bridge" in the wire. The left relay is connected directly to the transformer.

drehausschnitt.jpg

Regards

Markus
thanks 1 user liked this useful post by Markus Schild
Offline portpilot  
#25 Posted : 26 May 2020 17:19:48(UTC)
portpilot

Germany   
Joined: 26/05/2020(UTC)
Posts: 1
Location: Mecklenburg-Vorpommern, Rostock
Hallo Markus

Very nice work you have done. I struggle a bit to make this working with Scale Z turntable 8998 / Märklin. I modified it an it seems to work from the hardware side. I had to use a mosfet to switch the polarity.
But i am still testing how to get a two diget number via keypad in and out as "schritte". And a am no progammer :( My turntable has more then nine parking slots for the locos.

thanks a lot
Jan

Edited by user 25 June 2020 21:26:54(UTC)  | Reason: made progress

Offline carlostau  
#26 Posted : 24 September 2020 16:23:08(UTC)
carlostau

Argentina   
Joined: 11/07/2020(UTC)
Posts: 19
Location: Buenos Aires, Castelar
Hi Markus, this is an excellent instrutive. I was able to make it work on my turntable.
I was wondering if you have considered porting this to a tft touch screen.
I have developed a program to control the signals and turnouts via the touch panel and was thinking maybe I could try to "translate" the keyboard part to the LCD
Thanks
Offline Ross  
#27 Posted : 24 September 2020 22:47:14(UTC)
Ross

Australia   
Joined: 25/09/2006(UTC)
Posts: 868
Location: Sydney, NSW
Hi All,

Here is an article by John Barry that controls the 7186 turntable with Arduino and can be interfaced with TrainController software.

7186 Turntable Conversion with Arduino Operation



Ross
thanks 1 user liked this useful post by Ross
Offline Jvdwaa  
#28 Posted : 18 February 2021 18:52:04(UTC)
Jvdwaa

Netherlands   
Joined: 04/04/2017(UTC)
Posts: 17
Originally Posted by: JWS Go to Quoted Post
Hi Markus,
I am new here, a dutchman in his sixties, who has started again, and found an old turntable on ebay, and managed to copy your arduino scheme to run the turntable. Thank you for your scheme!! As I am using (the IB for) digital control, I wonder if I could "easily" incorporate the Arduino keyboard in the digital system (with turnoff decoder?) and necessarily (?) changing of the (brown) mass connection of the turntable motor.
I just want to thank you again and will start searching this forum for the answers on my questions.
Greetings,
Jan Willem


Hi Jan Willem,

Another Dutchman here BigGrin
I am currently working on building the solution of Marcus, but also adding a DCC interface.
The intention is that I can control the turntable both manually and by Koploper (the Dutch train control software).
Once I have it running, I will post the result on this page.
In the meantime I have already printed a case for the Arduino and the keypad, a case for the relay and ACS will follow shortly.

keypad.pngarduino.png
thanks 2 users liked this useful post by Jvdwaa
Offline Jvdwaa  
#29 Posted : 04 April 2021 17:24:23(UTC)
Jvdwaa

Netherlands   
Joined: 04/04/2017(UTC)
Posts: 17
Originally Posted by: Markus Schild Go to Quoted Post
Hi,

Many modellers and enthusiasts still use the old – style Märklin turntable 7186 (aka 7026 / 410 N).

I was always bored by the control with the two knobs. If you want to turn from position 1 to 5 you must observe the turntable all the time and wait until it stops at every position just to start it again.

My aim was to build a replacement for the old two – knob device with a numeric control without any modification of the turntable itself. The control device only works with turntables in good condition. If the bridge has contact- problems these problems must be solved first.



Hi Marcus,

I created the setup based on your description, but somehow things go wrong.
After an initial setting of the proper track, the turntable will properly move to the track indicated on the keyboard.
However, every subsequent selection will move only one track.
If I re-enter the actual track, the story repeats itself: the first move goes OK, any subsequent move in skipping 1 or more tracks will go wrong.

The one thing I notice is that after the first correct move (where every track is properly skipped), in the subsequent moves I hear the relay being pulled way before it should actually be pulled. The number of times the rely is pulled is not in line with the number of tracks that should be skipped (although it roughly matches).
Because I use a 3 column keyboard (without the ABCD column), I changed the code slightly:

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};

//Anschlüsse des Keyboards am Arduino. Wenn die Eingabe seltsame Ergebnisse ergibt, müssen die Keyboard Anschlüsse
//um 180° gedreht werden oder die Pins angepasst werden

//Connections of the keyboard. If you get strange results the pins of the keypad must be connected in reverse direction

//rows/columns en pin-assignment aangepast ivm 4x3 keyboard
//byte rowPins[ROWS] = {2, 3, 4, 5}; //connect to the row pinouts of the keypad
//byte colPins[COLS] = {6, 7, 8, 9}; //connect to the column pinouts of the keypad
byte rowPins[ROWS] = {3, 4, 5, 6}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 8, 9}; //connect to the column pinouts of the keypad

Did I do something wrong in my change or should I change some other lines tooo?

My programming skills are a bit rusty after almost 35 years...

Joost
p.s. once the program works OK, I will add a DCC-interface to my Arduino, see ArCoMoRa
Offline Crazy Harry  
#30 Posted : 05 April 2021 18:51:38(UTC)
Crazy Harry

Canada   
Joined: 18/11/2008(UTC)
Posts: 475
Location: Oakville, Ontario
Hi Joost,

I'm planning on using Markus' program as well. This will be my first experience with Arduino and I have ordered the parts, just waiting for them to arrive.

I have looked at Markus' coding and am playing with Arduino coding online, still learning! I can find the blinkled.h library he listed, but can't seem to download it properly - what did you do in this case?

As for your problem, I think it must be related to the saving of the last turntable position to the EEPROM, recheck your coding in those program sections. I don't think it is a keypad issue (I'm planning a 4x3 keypad as well which has a less intuitive pinout which I believe I have properly decoded).

Please update the thread on your progress. Thanks,

Harold.
Offline Jvdwaa  
#31 Posted : 05 April 2021 22:37:33(UTC)
Jvdwaa

Netherlands   
Joined: 04/04/2017(UTC)
Posts: 17
Originally Posted by: Crazy Harry Go to Quoted Post
Hi Joost,

I'm planning on using Markus' program as well. This will be my first experience with Arduino and I have ordered the parts, just waiting for them to arrive.

I have looked at Markus' coding and am playing with Arduino coding online, still learning! I can find the blinkled.h library he listed, but can't seem to download it properly - what did you do in this case?

As for your problem, I think it must be related to the saving of the last turntable position to the EEPROM, recheck your coding in those program sections. I don't think it is a keypad issue (I'm planning a 4x3 keypad as well which has a less intuitive pinout which I believe I have properly decoded).

Please update the thread on your progress. Thanks,

Harold.


Hi Harold,

I downloaded the blinkled.h library from https://github.com/bborncr/BlinkLed, you'll find the instructions to install the library on that page.

I really doubt that the saving of the position is the culprit, it has to do with the timing/trigger of pulling the relay. I haven't figured out how that works. As I wrote before, it has been a while since I have been programming...

Joost
thanks 1 user liked this useful post by Jvdwaa
Offline Crazy Harry  
#32 Posted : 06 April 2021 17:52:47(UTC)
Crazy Harry

Canada   
Joined: 18/11/2008(UTC)
Posts: 475
Location: Oakville, Ontario
Hi Joost,

Here is my theory on how the program works:

The program knows the initial position of the turntable either by programming it or from last use.

It reads the target track number you want to reach and determines the direction and shortest path there using the 10x10 matrix "Wege"

An impulse is sent to unlatch the turntable and the motor starts. At the same time the number of steps to the target is decreased by one. During the movement the Arduino monitors the current draw (ampere) of the motor. If the current draw is zero and the table hasn't reached the target track it sends another pulse to unlatch and continues.

Therefore, I surmise, that if the motor stops for some reason between tracks the unlatch impulse is sent and the count is decreased. I don't know how often the current draw is polled so I can't guess how long a pause will cause misinformation or even if the pause is long enough that the count is decreased several times. The result would be the turntable not reaching the correct target and an incorrect last position being stored in the EEPROM.

Thus your turntable has to have clean current pickup rings and strips and a good motor condition so that inadvertent motor stops cannot occur. Could this be your issue?

Regards,

Harold.
Offline Jvdwaa  
#33 Posted : 06 April 2021 19:40:31(UTC)
Jvdwaa

Netherlands   
Joined: 04/04/2017(UTC)
Posts: 17
Originally Posted by: Crazy Harry Go to Quoted Post
Hi Joost,

Here is my theory on how the program works:

The program knows the initial position of the turntable either by programming it or from last use.

It reads the target track number you want to reach and determines the direction and shortest path there using the 10x10 matrix "Wege"

An impulse is sent to unlatch the turntable and the motor starts. At the same time the number of steps to the target is decreased by one. During the movement the Arduino monitors the current draw (ampere) of the motor. If the current draw is zero and the table hasn't reached the target track it sends another pulse to unlatch and continues.

Therefore, I surmise, that if the motor stops for some reason between tracks the unlatch impulse is sent and the count is decreased. I don't know how often the current draw is polled so I can't guess how long a pause will cause misinformation or even if the pause is long enough that the count is decreased several times. The result would be the turntable not reaching the correct target and an incorrect last position being stored in the EEPROM.

Thus your turntable has to have clean current pickup rings and strips and a good motor condition so that inadvertent motor stops cannot occur. Could this be your issue?

Regards,

Harold.


Hi Harold,

I did not dig as much as you into the code, but your logic does make sense. The turntable itself seems to work flawlessly, although I have to admit I did not check the actual power consumption during operation.
I checked the operation again today, just to make sure I was not sharing nonsense. When controlled by manual operation, it runs fine.
When I operate it via the Arduino, the number of times the relay is indeed pulled in line with the number of tracks it has to move, but it pulls the relay just somewhere in between tracks.
As I agree with your description how the code , I will now first clean the electrical contacts of the turntable and come back to this discussion after that.

Regards,

Joost
thanks 1 user liked this useful post by Jvdwaa
Offline Crazy Harry  
#34 Posted : 07 May 2021 20:45:37(UTC)
Crazy Harry

Canada   
Joined: 18/11/2008(UTC)
Posts: 475
Location: Oakville, Ontario
I have successfully implemented this modification! I did take the liberty to translate the variable names in the sketch to something similar in English and modified the keypad section to utilize a 12 button version (4 rows x 3 columns, since the lettered keys are not used/required).

This is a great mod for the old turntable without having to make any physical changes to the turntable.

Thank you Markus for your original work!!!

Cheers,

Harold.
thanks 3 users liked this useful post by Crazy Harry
Offline Jvdwaa  
#35 Posted : 21 February 2023 15:17:47(UTC)
Jvdwaa

Netherlands   
Joined: 04/04/2017(UTC)
Posts: 17
Originally Posted by: Markus Schild Go to Quoted Post
Hi,

Many modellers and enthusiasts still use the old – style Märklin turntable 7186 (aka 7026 / 410 N).

I was always bored by the control with the two knobs. If you want to turn from position 1 to 5 you must observe the turntable all the time and wait until it stops at every position just to start it again.

My aim was to build a replacement for the old two – knob device with a numeric control without any modification of the turntable itself. The control device only works with turntables in good condition. If the bridge has contact- problems these problems must be solved first.


Hi Markus,

2 months ago I retired, so finally enough time to spend more time on our Marklin hobby.

I still encounter errors in the operation of the turntable in combination with the Arduino. I took the turntable apart and cleaned it thoroughly, but I still encounter short intermissions in the turning process, resulting in a miscalculation in the number of tracks.

The best way to avoid this, is to put a small delay in the reading of the interruption. I checked your code, and think that this part of the code is taking care of that:

void loop() {
led1.update();
float ampere = 0;
for (int i = 0; i < 20; i++) {
ampere = ampere + (abs(analogRead(A2) - 512));

delay(1);
}
pos = last;

But also in
while (schritte > 0) {
ampere = 0 ;

for (int i = 0; i < 50; i++) {
ampere = ampere + (abs(analogRead(A2) - 512));

delay(1);

}

My questions are:
- is this indeed the proper code that is measuring the interruption?
- if so, which value in which part of the code should I increase to overcome erroneous interruptions?

Looking forward to your reaction (or from somebody else BigGrin )

Regards,

Joost
thanks 1 user liked this useful post by Jvdwaa
Offline JWS  
#36 Posted : 21 February 2023 18:15:40(UTC)
JWS

Netherlands   
Joined: 06/01/2019(UTC)
Posts: 4
Location: Zuid-Holland
Hi Joost,
I have the same problem, and I wonder if a longer pulse from the arduino to the relais that powers the magnetswitch that releases the table and starts the turning motor could be helpfull.........

With some help I have managed to use the keyboard and/or the DCC signals from my old Intellibox. Both have the same problem that quite often the turntable either doesn't start at the first pulse or miscalculate the destination (mostly 1 step less).

So hopefully the experts are still reading this topic.

Greetings,
Jan Willem
thanks 1 user liked this useful post by JWS
Offline Jvdwaa  
#37 Posted : 21 February 2023 18:40:06(UTC)
Jvdwaa

Netherlands   
Joined: 04/04/2017(UTC)
Posts: 17
Originally Posted by: JWS Go to Quoted Post
Hi Joost,
I have the same problem, and I wonder if a longer pulse from the arduino to the relais that powers the magnetswitch that releases the table and starts the turning motor could be helpfull.........

With some help I have managed to use the keyboard and/or the DCC signals from my old Intellibox. Both have the same problem that quite often the turntable either doesn't start at the first pulse or miscalculate the destination (mostly 1 step less).

So hopefully the experts are still reading this topic.

Greetings,
Jan Willem


Hi Jan Willem,

There are basically 2 challenges:
1. to get a long enough starting pulse
2. to overcome contact problems when the bridge is moving and the software thus assumes that it has already found the next track.

In the Koploper forum Chris Burger managed to get things going in a different way, see https://www.koploperforu.../topic.asp?TOPIC_ID=6987 (all Dutch sorry for the other non-Dutch speaking readers). He also had the challenge of power interruptions during the traveling of the bridge and he added a delay.

Joost
thanks 1 user liked this useful post by Jvdwaa
Offline Jvdwaa  
#38 Posted : 08 March 2023 18:21:53(UTC)
Jvdwaa

Netherlands   
Joined: 04/04/2017(UTC)
Posts: 17
After many hours of trying to get this solution of Markus working (see my previous feedback) I finally gave up.

In the Netherlands a rather technical guy named Chris Burger, has made a dedicated 7186 decoder: https://www.koploperforum.nl/topic.asp?TOPIC_ID=6987 (sorry, all Dutch). His solution works in conjunction with the train control software Koploper, iTrain and Rocrail.

Given the reputation of Chris I have given it a try and, after some small initial problems, it actually works fine.

The solution is different compared to the one of Markus: with Markus solution you will have a keypad in which you can command the turntable directly, in the solution of Chris you'll have to use your control station (Intellibox, Marklin CS, Esu Ecos).
I have successfully configured my Ecos to control my turntable.

Joost
thanks 1 user liked this useful post by Jvdwaa
Offline matiasdc  
#39 Posted : 18 June 2023 01:39:38(UTC)
matiasdc

Argentina   
Joined: 01/08/2016(UTC)
Posts: 4
Location: Ciudad Autonoma de Buenos Aires, Buenos Aires
Hi Markus! I have a question. What happend If i want to use it with a cs3 wich wire i have to change? Thanks
Offline matiasdc  
#40 Posted : 18 June 2023 01:47:54(UTC)
matiasdc

Argentina   
Joined: 01/08/2016(UTC)
Posts: 4
Location: Ciudad Autonoma de Buenos Aires, Buenos Aires
I want to use the dame environment but the track It Is power by a cs3 insted of the trasnformer thanks
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

| Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 1.627 seconds.