Duq Posted June 26, 2019 Posted June 26, 2019 @Toastie Probably a question for you: I'm trying to control a train with an RCX. That works, and using a light sensor to stop it where I want also works. Most of the time.... I'm running the output on power 1, that's fast enough for my tram. I tried 0, but that's too low to make it move. My problem is that every now and then the output appears to give the train motor more power. As a result it runs faster, overshoots the mark at the light sensor, and my program is in trouble.... Have others noticed this problem or is it a problem with the brick I'm using? If it's a known problem, is there a way around it? Would writing my own PWM be an option or will that not work because RCX already uses PWM itself? Quote
Toastie Posted June 26, 2019 Posted June 26, 2019 @Duq thanks for the flowers I am controlling some of my trains with RCX' as well. And it was a pain in the butt to get it right with the LEGO firmware, which has these 8 power levels. If I were you I would not write my own PWM code, I'd get RobotC for RCX. It is freely available at the RobotC website. I assume you are using NQC to get your programs do what the should do, right? If so, the transition to RobotC is easy. Much easier than writing your own PWM. RobotC gives you power settings in steps from 1 to 100 in increments of 1. Plus: I can surely send you my RobotC train control program - which you need to modify - it comes along with PID control of the output power, provided you put a LEGO rotation sensor on one of your trains axles. in that case a train for sure runs with a speed corresponding to power=10 when you set power=10. Best, Thorsten Quote
Toastie Posted June 27, 2019 Posted June 27, 2019 On another thought: The torque created on the train motor at low power levels is next to nothing. It kicks in at about power of 3 or 4. When your tram almost runs freely without much friction or moment of inertia it should run fine. The very moment some sort of additional friction (slight relocation of axles, track curves or bumpy track, whatever), power level 1 may simply not create enough torque to keep up the desired speed. This is the very reason I added some PID code to the program operating the train motor. Best Thorsten Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.