Hi! This is my first post. I am trying to built the wikinger decoder from here http://www.frederiksson.dk/indexeng.html. I have built the hardware many times, using Pic 16F628 or 16F84. I programming them well. When i put the pic on the socket of the decoder, it works fine but pwm on RB2 RB3 always unstable. I attach you the hex of the Pic16F628, and a schematic. Any information will be helpful. Thank you! Vasilis
Hallo, Unstable in the sense that the locomotive changes speed? The PWM on RB2 RB3 is realised in software which makes it probably a bit irregular. Regards Hanspeter
While the code executes scanning and evaluating the input to receive a valid instruction he also executes any valid instruction received and all the while he calls from different places the subroutine to switch on/off the outputs to simulate a PWM. I don't know if they have counted/timed the milliseconds inbetween calls, but I guess not, so this results in different on/ cycles. There is no feedbackloop to regulate/compensate different feeding-voltage scenarios of the tracks The PWM in the chip is not used, also there are no Interrupt subroutines used. Does the speed of your locomotive vary? Do you use original Märklin Motorsets?
I use original equipment of Marklin. I try it, not on the tracks but on a breadboard so there is no problem of distortion from the sliding of the loco on the tracks. The decoder obey to the control unit (mobile station). The problem is obvious when i keep the speed steady. The motor works fine, for a few seconds, and for a millisecond the speed decrease, and then it works fine, and for a millisecond the speed decrease, and again and again... If the PWR in the chip is not used, how the motor works?
Hi I built the decoder with 16f628 and is ok.But with changes can't find some ci only the pic. I have ac motor,you used el dec 3-1 is for dc motors How you programm the decoder whith mobile station?,i can't Regards D.Ramirez
Did you made changes to the code? I could n't programming with the mobile station.
It stops after about 4 sec, its the overcurrent protection of the terminal. A problem around the H-Bridge?
Hello Vasilis Yes, the speed is stable,not very much but similar another decoder with ac motor ( this is problem the ac motor) Today Marklin not use ac motors only dc and dc brushlees. When i built the deco i can´t find the ic for drive the motor, i try with different mosfet, only the 2sk2499 running well another posibility is transisitor bipolar darlington BD681 with 4k6 resistor I have another problem with the transistor for lamps ,used 2n7000 and bs170, very inestables Used bc547 and resistor 4k7 o bc337 for smokegenerator I not made change to the code When i programing pic said "error adress29" but function well , i can program on track , i built the encoder from "Frederiksson page" I send you file.hex and two bmp the hardware. Where are you from? Regards, Daniel
On the schematic dec-3-1-b the MCLR is connected to VCC. Om the print its hanging in the air. Connecting MCLR to VCC stops the flashing of the outputs and also the motor becomes stable. The resistors R8 and R9 are fine with 980ohms. On the schematic the ZHB6790 is drawn with the pins not following the actual order What is funny when you install it in a loco and run it on a actual layout with boosters is that on pressing start it runs about 30cm at high speed no matter at what speed its supposed to be. During initialisation the FETs hanging in the high impedance outputs. They need some pull-down resistor. Also generally its not possible to run at slow speeds, maybe a reprogramming of the speed curve would help.
After review I saw that I forgot R8 with 3.3k, after changing it to 1k it does not run at high speed anymore after pressing start. All elements required you could order at Digikey.com
Sorry for the delay. I have made many of these circuits for DC and for AC motor with the pic16F628. All these had the same result. They never been stable enough. Also the programming of the decoder with the pic16F628 always had an error on the memory address 0029. If you try to construct the circuit with the pic16F84 you will find that it is more stable by far from the others circuits. Here there is a link for the same decoder with some improvements http://home.arcor.de/dr.koenig/digital/ewiking.htm I continue to believe that the circuit with the pic16f628 could be better if someone has the pleasure to improve the code. For the components, i made some changes. I use a ULN2004 for powering the four extra functions and the lights. For the motor, you can use a h-bridge like that i attach you. A better circuit is, using the IRF9103 and it is attached on the second schematic. All the components i found them very easy on ebay.
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.