mikezang Posted April 4, 2014 Posted April 4, 2014 The output of PF receiver can be set 1 - 8, and relevant PWM percent as below stop 1: 26.4% 2: 37.9% 3: 49.4% 4: 63.2% 5: 74.7% 6: 87.4% full throttle I want to know if it is possible to set PWM between 0 - 100% to PF receiver output? Quote
JopieK Posted April 5, 2014 Posted April 5, 2014 see the official LEGO documentation... http://www.philohome...unctions_RC.pdf so what is your question again? you seem to be answering it first, then asking... Quote
mikezang Posted April 5, 2014 Author Posted April 5, 2014 see the official LEGO documentation... http://www.philohome...unctions_RC.pdf so what is your question again? you seem to be answering it first, then asking... I want to know if someone can hack it to set PF receiver PWM to 0 - 100%, because like old RCX, lego firmware only support output to 0 - 7 (= 0 - 100%), but brickOS can set to 0 - 255 (=0 - 100% step in 1/255%), and RobotC can set to 0 - 100 (= 0 - 100% in step4%). Quote
JopieK Posted April 5, 2014 Posted April 5, 2014 you apparently don't understand what PWM is and how it works: So if you want to do that you can, but you will need another controller. It does not make any sense at all though, we have a controller for some LEGO train project that uses 8-bits but effectively 4 bits are just as good: there already is a 'dead' range in the lower regions. Most of the time you don't want your train motor to have full speed (it will derail), so 4 bit resolution is high enough with these LEGO train motors. Quote
mikezang Posted April 5, 2014 Author Posted April 5, 2014 you apparently don't understand what PWM is and how it works: So if you want to do that you can, but you will need another controller. It does not make any sense at all though, we have a controller for some LEGO train project that uses 8-bits but effectively 4 bits are just as good: there already is a 'dead' range in the lower regions. Most of the time you don't want your train motor to have full speed (it will derail), so 4 bit resolution is high enough with these LEGO train motors. I know if PWM lower 30%, train is never moving as lower torque. I am porting RCX PID speed control from RobotC by Thorsten Benter to brickOS, so that I am thinking if I can set any percent PWM for receiver, then I can use PID speed control to PF motor, that is why I asked such question. Quote
JopieK Posted April 5, 2014 Posted April 5, 2014 I'm now totally confused and puzzled. You are doing this for train control right?! Why would you want to use PID for train control?!! Apart from that, if you really wanted to use PID control, it would be almost the only option to either use your own controller or directly control the train motor from the NXT / RCX. You just can't use the PF receiver for that, and... it does not make sense at all to want to do that (if you were a high school / college student of mine my reaction would have been even more amazed ;)) As I said, we (my student and I) have our own train controller but would never want to use PID. PID or even PD is nice for robotics in a unpredictable situation, not for a very predictable situation like trains that move in one direction or the other and can't move sideways etc. Quote
mikezang Posted April 5, 2014 Author Posted April 5, 2014 I'm now totally confused and puzzled. You are doing this for train control right?! Why would you want to use PID for train control?!! Apart from that, if you really wanted to use PID control, it would be almost the only option to either use your own controller or directly control the train motor from the NXT / RCX. You just can't use the PF receiver for that, and... it does not make sense at all to want to do that (if you were a high school / college student of mine my reaction would have been even more amazed ;)) As I said, we (my student and I) have our own train controller but would never want to use PID. PID or even PD is nice for robotics in a unpredictable situation, not for a very predictable situation like trains that move in one direction or the other and can't move sideways etc. Sorry that I am not high school student:( I don't think you are right about PID control train, train will move slowly on curve if you set the same output power, but using PID control you can increase output power on curve, you should check Thorsten Benter post in this forum, you will found PID control train move in constant speed even in curve. And I don't have PF remote control but I am using RCX and its remote to control my PF trains on the fly, this is why do I have such strange thinking... Quote
JopieK Posted April 5, 2014 Posted April 5, 2014 Of course the speed will be more lineair with PID, that is what PID is all about, but maybe I just don't have complicated enough trains, so pardon my in that case :) Your topic title says: "PF receiver", so that is why I thought you wanted to use the PF receiver with PID control. I don't think it was here though, it was in Railbricks: Issue 3 - Spring 2008. I guess you could use his strategy, but then attach the PF motor using the adapter cable directly to the RCX without using the PF receiver (that you apparently don't have so also even can't use?!). Quote
mikezang Posted April 5, 2014 Author Posted April 5, 2014 (edited) Of course the speed will be more lineair with PID, that is what PID is all about, but maybe I just don't have complicated enough trains, so pardon my in that case :) Your topic title says: "PF receiver", so that is why I thought you wanted to use the PF receiver with PID control. I don't think it was here though, it was in Railbricks: Issue 3 - Spring 2008. I guess you could use his strategy, but then attach the PF motor using the adapter cable directly to the RCX without using the PF receiver (that you apparently don't have so also even can't use?!). I can use RCX to control train and PF motor with PID directly, I also can use RCX to control PF receiver with train and PF motor without PID, so I am Curious if I can then use RCX to control PF receiver with motors with PID. Now you told me that is impossible, I think that I got answer, though it is very Shame! This is what I talked http://www.eurobricks.com/forum/index.php?showtopic=45440 Edited April 5, 2014 by mikezang Quote
JopieK Posted April 5, 2014 Posted April 5, 2014 well, you essentially could, connect an IR led to the RCX output and modulate the PF signal over it. But your resolution will still be 4-bits unless you use arduino or some other microcontroller with a motor driver at the receiving end (arduino / atmega motor control will allow an 8-bit resolution 0..255, other DAC's would allow even higher resolution). Quote
Duq Posted April 5, 2014 Posted April 5, 2014 I want to know if someone can hack it to set PF receiver PWM to 0 - 100%, because like old RCX, lego firmware only support output to 0 - 7 (= 0 - 100%), but brickOS can set to 0 - 255 (=0 - 100% step in 1/255%), and RobotC can set to 0 - 100 (= 0 - 100% in step4%). The short answer is no. Like you said there, the trick here is replacing firmware. You can replace the firmware on the RCX but not on the PF controller. If you want more accurate PWM control of your train you have two options; put an RCX brick in your train (tricky, they're BIG) or use 9V motors and track and use an RCX with brickOS as your speed controller. Or of course option 3: convert your trains to DCC... Quote
codefox421 Posted April 7, 2014 Posted April 7, 2014 see the official LEGO documentation... http://www.philohome...unctions_RC.pdf On page 10 under "Clear/Set/Toggle" mode, there are commands "Increment PWM" and "Decrement PWM". I do not own a PF receiver, so I wonder if anyone has played around with these commands? Maybe they can give finer resolution than the stock +/- 7 steps. Quote
Duq Posted April 8, 2014 Posted April 8, 2014 Haven't played with this particular mode yet but since all other modes that have increment/decrement commands refer to the 7 steps I'd be surprised if this one would be different. Quote
ZueriHB Posted April 8, 2014 Posted April 8, 2014 The Increment / Decrement commands are implemented in the variable remote control used and supplied with the PF train sets. The turning of the wheel just sends the increment / decrement commands, which go from -7 to +7, incl. 0. Quote
codefox421 Posted April 8, 2014 Posted April 8, 2014 ...increment/decrement commands refer to the 7 steps... ...increment / decrement commands, which go from -7 to +7, incl. 0. Something about that PDF seemed different from what I was used to. It appears to be the v1.0 spec. I was thinking of the "Increment numerical PWM" and "Decrement numerical PWM" commands as seen on page 9 of the v1.20 spec: http://cache.lego.co...er_Download.pdf Since it appears in addition to "Increment PWM" and "Decrement PWM," I would think it differs from the +/- 7 steps in some way. Thoughts? It might be worth testing. Maybe the v2 receivers implement the v1.20 spec? Quote
mikezang Posted April 8, 2014 Author Posted April 8, 2014 Something about that PDF seemed different from what I was used to. It appears to be the v1.0 spec. I was thinking of the "Increment numerical PWM" and "Decrement numerical PWM" commands as seen on page 9 of the v1.20 spec: http://cache.lego.co...er_Download.pdf Since it appears in addition to "Increment PWM" and "Decrement PWM," I would think it differs from the +/- 7 steps in some way. Thoughts? It might be worth testing. Maybe the v2 receivers implement the v1.20 spec? I also found there are two inc/dec, what different? Mode = Clear/Set/Toggle/Inc/Dec Data DDDD 0000 Toggle full forward (Stop → Fw, Fw → Stop, Bw → Fw) 0001 Toggle direction 0010 Increment numerical PWM 0011 Decrement numerical PWM 0100 Increment PWM 0101 Decrement PWM Quote
Duq Posted April 8, 2014 Posted April 8, 2014 On my V1 receiver the numerical increment and decrement don't seem to work. If the motor is stopped nothing happens. If the motor is turning then either inc numerical or dec numerical sets the motor to full speed in the direction it's running. The Toggle direction command seems to have no effect. Quote
zephyr1934 Posted April 9, 2014 Posted April 9, 2014 On my V1 receiver the numerical increment and decrement don't seem to work. If the motor is stopped nothing happens. If the motor is turning then either inc numerical or dec numerical sets the motor to full speed in the direction it's running. The Toggle direction command seems to have no effect. I THINK there were two versions of V1, the original and updated. I think the original did not support some of the commands found in the documentation (which was released about the same time as the updated V1). The only externally observable difference between the two is that the led on the receiver blinks one or something like that. Assuming my memory isn't garbled, that might explain why your receiver isn't receiving as specified. Quote
Duq Posted April 9, 2014 Posted April 9, 2014 That's an interesting one. I've just tried another receiver (recent S@H purchase, expecting a V2 but getting V1) and that does indeed behave differently. Like you said, when you turn on the battery there's a faint blink of the receiver LED before it comes on. On the newer receiver the inc numerical and dec numerical commands behave mostly as I had expected from the documentation; if the motor is running then increment numerical (0010) will increase the speed, whatever direction it's running. Decrement numerical (0011) will reduce the speed. When the motor is stopped, increment numerical does not turn it on. To answer the original question: this inc/dec does use the same 7 speeds as other modes. Toggle direction (0001) does what it says; it reverses the direction, keeping the same speed. In comparison, increment PWM (0100) and decrement PWM (0101) behave like the speed controller; if the motor is running forward and you keep decrementing the speed it will go 'past 0'. After stopping it will reverse with increasing speed. Quote
codefox421 Posted April 9, 2014 Posted April 9, 2014 It's unfortunate that +/- 7 is as fine of steps as we get, but good to know what these PF commands actually do. Thanks Duq! Quote
JopieK Posted April 11, 2014 Posted April 11, 2014 I also found there are two inc/dec, what different? Mode = Clear/Set/Toggle/Inc/Dec Data DDDD 0000 Toggle full forward (Stop → Fw, Fw → Stop, Bw → Fw) 0001 Toggle direction 0010 Increment numerical PWM 0011 Decrement numerical PWM 0100 Increment PWM 0101 Decrement PWM There is a difference in the Train Remote and the Technic Remote. Apart from that not all functions are currently used in available remotes but of course will work in the receiver and can be used if we use propriety methods. Quote
Duq Posted April 12, 2014 Posted April 12, 2014 There is a difference in the Train Remote and the Technic Remote. Apart from that not all functions are currently used in available remotes but of course will work in the receiver and can be used if we use propriety methods. Yup, there is of course a difference because they do different things. One has joysticks for full forward and full reverse, the other has jogs for speed control. 8879 Speed controller Uses Single Channel mode - PWM except when both stop buttons are pressed, then it uses the 'Brake then float' command for both channels on Combo Direct mode. 8885 Simple controller Uses Combo Direct mode for everything. So there's a few modes that the current controllers don't use. I've created this picture to illustrate the difference between the two increment/decrement commands: LEGO PF PWM by Duq, on Flickr 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.