THIS IS THE TEST SITE OF EUROBRICKS!
Everything posted by Toastie
-
Some PowerFunctions insights: The LEGO LiPo rechargeable battery and L
Hi, well, you could, just set it to full forward or backward all the time - the speed regulator puts voltages close to 9 V out. However, I'd rather go with a 12 V supply for the LiPo - max. loading current is less, which is alwys good for longer stretches of track, since the voltage drop will be smaller. Regards, Thorsten
-
Some PowerFunctions insights: The LEGO LiPo rechargeable battery and L
Hi there, nothing happens at all, the LiPo has a built-in diode labeled "A" on the copy of Philo's photo below: However, the LiPo would also not charge, which is not effective. This is why you should add a bridge rectifier into the charging line - in this case there is always + 12 V connected to the center and 0 V to the outer part of the DC plug (BTW the plugs frequently come with cheap wall warts, just cut of the plastic base of the 3.5 x 1.35 mm plug. I did that as shown in the photo below: I am prefering the small SMD types, as shown here - the rectifier should rate about 1 A: Once installed, you will always have charging voltage with the correct polarity at the LiPo DC-in jack. Regards, Thorsten
-
Some PowerFunctions insights: The LEGO LiPo rechargeable battery and L
Dear All, for some time now, I have carefully followed the wonderful discussions in the various EuroBricks forums on the usage of power systems for electrification of LEGO models, particular the ones in the TrainTech section. Every now and then, there appear to be serious “How-to” questions with regard to 9 V/PF train “conversions”. Here are some comments about this issue, focusing on the LEGO Lithium polymer rechargeable battery (#8878) for application in electrified LEGO train models (Note: Sorry for using BrickShelf deeplinks, just uploaded the stuff ...) Generally speaking, TLC appears to push the various PowerFunction elements as a more or less global approach for electrification of LEGO models, at least in the current “9 V domains” (Technic, Mindstorms, RC-Train), right? Recently a PF-type train motor appeared and in fact, the prefix “PF” appears to be well justified – as Philipe Hourbain has very recently demonstrated. After reading this article by Brian Williams in RailBricks, Issue 6, page 17, I was finally convinced that $50 may be worth spent for some LiPo “research”: Is the LEGO LiPo really that, a full blown real world “LiPo” or does it need to be purchased in pair with the LEGO AC charger (#8887) and be carefully treated like a raw 10 V egg? In other words: How does it behave electrically? What can we really do with it? In short: The LiPo meets expectation in every regard! Here are the results from some measurements. To really benefit from the superb LiPo performance however, DC track power-pickup is necessary. This has been amply discussed in EuroBricks; I prefer modified 9 V train motors, where the original “9 V motor only” function is fully restored when a classical LEGO 9 V cable (with two 2x2 electrical plates) is connected to the terminal of the motor. Two more custom cables (DC pickup to LiPo with bridge rectifier, and PF receiver to modified 9 V train motor) are required as well. There will be a full article about the LiPo performance in an upcoming issue of RailBricks – with all the details on cables, “test-bed” set-up, etc. (Basically, the approach is completely analog to my RCX stuff shown here (page 53, figure 9. Here, the RCX charging cable does not need to have a bridge rectifier though, TLC already built that into the RCX, very smart!). Here we go: 1) The 7.4 V/1.1 A LEGO PF Lithium polymer rechargeable battery can be charged with a broad range of DC input voltages ranging from 9 V to 18 V, see figure below. 10 V or above is recommended, since the then available full charging current is minimizing charging time. 12 V seem to represent the best price-performance ratio, as judged from the availability of cheap “wall wart” type power supplies. In other words: You don’t need to buy the way too expensive 10 V LEGO charger! I believe, 10 V is simply a good marketing joke (who on earth else is using 10 V? Oh yes, sorry I forgot: Safety, safety, safety. Well, at least you can’t swallow cheap wall warts that easily, and the power cord can probably be viewed as a safety pull-back mechanism. Ha, another one: Google for “10v dc power”. Hit #1: LEGO S&H … they are smart at TLC, aren’t they). 2) The maximum LiPo charging current was calculated in this MBFR forum entry, replies #3 and #4 (you would need to polish up your German though ..., but I bet there are many relevant forum entries at EuroBricks as well) before to be around 750 mA average, which was based on information from the LEGO service department and the fine print on the LiPo (1 ½ hours charging time, 1.1 Ah LiPo capacity). The present measurements however suggest a maximum charging current of 550 mA, even with two stalled XL motors present either directly on the output of the LiPo or a connected PF receiver output, respectively, set to full forward, see figure below. So when your cheap wall wart can lift that, you should be fine. Figure 1: LiPo DC input voltage vs. LiPo EDIToutputINPUT (arghh, sorry!!!) current, with a stalled(!) PF XL motor present. That thing should draw more than 1 A ... At 20 V DC-in the LiPo "turns off", and can't be re-animated anymore. Well, I did some measuremenst on the PCB, see Philo's photos here, everything seemd ok, but it still played dead. I waited 4 days, and then: Bingo, back alive, however with fully discharged battery. Charged it at 12 V, did it again, it "died" again at 20 V, same procedure - the LiPo is doing well again. A-m-a-z-i-n-g! 3) This suggests that for electrification of large train layouts with constant DC new or used computer power supplies are perfectly well suited; they deliver easily well above 10 A on the 12 V line. 12 V car lead batteries would also work well for many, many hours at high total track currents and they can be recharged with relatively cheap power supplies, e.g. overnight. There are many more options. 4) The LiPo works well as uninterruptible power supply (UPS); the output characteristics remain pretty much constant, regardless of charging voltage. The transition from DC to battery power is smooth and without any problems. There are some reports on issues with the interruption of the charging voltage (i.e., LiPo turns off). This has been observed in the present measurements only, when the charging plug was forcefully removed from the LiPo, but never when the charging voltage was simply turned off (e.g., by driving a DC pickup train from powered to non-powered track). The figure below shows the performance of a test-bed train on a layout with two reversing loops (short DC blackout, polarity change), some RC tracks (power outage), and mostly powered 9 V track present. Photo of priciple of operation (the charging line has an SMD-type bridge rectifier): Photo of train test-bed: Figure 2: Round time vs. total run time of the test-bed shown above (Hybrid 9V/RC train, power pickup, PF LiPo, PF receiver, 10 cars, speed level "3", both motors on one PF receiver output. Red curve: Fully charged LiPo, no track power. Run time slightly above 4 hours. Blue curve: Starting with entirely flat LiPo from red experiment, with 12 V track power. LiPo seems to net-charge over time, since round time eventually goes down. After 7 hours, 12 V DC was removed: Indeed the LiPo was almost fully recharged, it ran for another 3 hours Summary: The LiPo is a PF element which readily combines the best of both worlds, PF and 9 V train. DC power pickup is required in some way though. Due to the relatively stable output of the LiPo, train driving characteristics are virtually constant when going over powered 9 V or RC plastic track. More than one train can be operated on one stretch of powered 9 V track (I know, we all knew that already ...) Charging of the LiPo is automatically enabled on powered stretches of 9 V track; no access to the charging jack is necessary. This means that your train design is less restricted; just completely hide the LiPo somewhere inside and stop the train on powered track. What about using DC power from you 12 V train layout for feeding a LiPo equipped PF train as well? I have no 12 V tracks, so this is pure speculation, but should work well: The 12 V train system features a beautiful power pickup brick (#x552). If you run the 12 V via a bridge rectifier into a PF LiPo, you can use all your PF elements on the 12 V system as well … which then of course means that you may want to cross over to 4.5 V tracks without a glitch due to the USP function of the LiPo battery. This is what I’d call “Building across multiple themes”. As far as I am concerned, TLC did it again. There is more to come – the PF receiver is another very nifty piece of equipment … Have fun + Play Well Thorsten
-
Automated train -- extended
Hi Kolaf, this is awesome work! Really great. I guess the micro controller you are using is pretty smart. Did you see this though: Masao is doing comparable things this with an RCX on board (and all the design restrictions that come with it ...). I have some experience with RCX controlled trains (http://www.eurobricks.com/forum/index.php?showtopic=45440) as well. Now, do you think both approaches could be merged into one? In other words, you would "control" the train from a computer using some sort of messaging, but this could be "overridden" by the codes embedded in the track layout (and vice versa)? This would be cool! I am entertaining the idea of incorporating a light sensor into my trains ... Question would be: How fast does the controller need to be to be able to recognize the coded track sections? Since the RCX' in the trains I have built are running RobotC firmware, the are pretty fast. Do you think this could work? All the best - I am looking forward to your updates!!! Thorsten
-
LEGO Train control using RCX1.0 PBricks
Hi JopieK, this is a good question and comment! Well as far as I understand PID loops and servos (I may be quite wrong here!): The 9 V train motor alone is just that: A simple DC motor. Many people call a closed-loop system that does not use a stepper motor a servo system or "servo". So a simple DC motor that is connected to any kind of velocity controller may be called a servo motor. In this regard you are absolutely right: The combination rotation sensor + RCX + 9 V train motor (with both motor and sensor on the rails = closed loop) is representing a servo system. There are many different kinds of control loops; for servos quite often PID is implemented. So I guess you are right: The closed loop installed on my trains is representing a servo system. And this system uses the PID algorithm for control (so my statement may be right as well ...). I have programmed the PID algorithm into the RCX as one task. It just monitors the rotation sensor reading every 60 ms and then calculates the deviation form the set point (desired speed) and the other errors you need for PID to adjust the motor power output level. I hope that this makes sense. Regards, Thorsten Hi JopieK, I forgot: This is the code for the PID loop running on the RCX. Just in case. The entire program can be donwloaded on the RailBricks website, section build instructions, diesels, gp40_RCX. Regards, Thorsten //--------------------------------------------------------------------------------------------------------------------- task PIDSpeedControl() { /* PID loop. The algorithm is adapted from the eBook "The PID Control Algorithm - How it works, how to tune it, and how to use it" by John A. Shaw (2nd edition, 2005). Some data on the LEGO RCX rotoation sensor used for train speed measurement: - 16 ticks per 360 deg rotation. - 5.5 cm travel path per 360 deg rotation using the RC trainwheels = 3.4 mm per tick. */ //Local constants const int cnSpeedCalFactor = 320; //Calibration factor for rotation sensor reading/time[T2] => //speed conversion [% scale]. //Local variables //Variables used in referenced BASIC code. //--------------------------------------------------//--------------------------------------------------------------- float fActualSpeed; //Input [%]. float fActualSpeedD; //InputD. float fActualSpeedLast = 0; //InputLast; needs to be initialized for first PID loop. float fPIDError; //Err. float fPIDFeedBack = 0; //Feedback; needs to be initialized for first PID loop. float fOutputPower; //OutP. //PID_ROT_SENSOR_DIR //Action. //bFlagPIDSpeedControl //Mode. //not required (?) //OutPutTemp. //nPIDSpeedSetpoint //SetP. ClearTimer(TMR_SPEED); //Reset speed measurement timer 2 for initial PID loop access. SensorValue[ROT_SENSOR_IN_1] = 0; //Reset any accumulated rotation sensor ticks on log. input 1 //for initial PID loop access. //--- PID loop ------------------------------------------------------------------------------------------------------ while (true) { while (time1[TMR_SPEED] < nPIDLoopWaitTime); //Note: 0 ms loop time delay is too short to accumulate //meaningful rotation sensor tick readings at low speeds. fActualSpeed = SensorValue[ROT_SENSOR_IN_1] * cnSpeedCalFactor * PID_ROT_SENSOR_DIR / time1[TMR_SPEED]; //Speed calculation. ClearTimer(TMR_SPEED); //Reset speed measurent timer. SensorValue[ROT_SENSOR_IN_1] = 0; //Reset accumulated rotation sensor data. if (bFlagPIDSpeedControl) //PID algorithm ------------------------------------------------------------------------- { fActualSpeedD = fActualSpeed + (fActualSpeed - fActualSpeedLast) * fPIDDerivTime; fActualSpeedLast = fActualSpeed; //Store current speed value. fPIDError = nPIDSpeedSetpoint - fActualSpeedD; //nPIDSpeedSetpoint is calculated from nRampedPower. fOutputPower = (fPIDError * fPIDGain) + fPIDFeedBack; if (fOutputPower > 100) fOutputPower = 100; //Restrict nOutputPower to firmware power range. if (fOutputPower < -100) fOutputPower = -100; fPIDFeedBack += (fOutputPower - fPIDFeedBack) * fPIDResetRate; if ((nRampedPower == 0) && (fActualSpeed == 0)){//Required to fully remove power from the motors; at low output fOutputPower = 0; //power levels the train stops with zero PID loop error but fPIDFeedBack = 0; //power is still around 20 with no torque and speed = 0. fActualSpeedLast = 0; } } else //Manual speed control --------------------------------------------------------------------------------------- { fOutputPower = nRampedPower; //Set output power to ramped power as calcualted in task //ramp_power [% scale]. fPIDFeedBack = fOutputPower; //Store PIDFeedback and current speed for bumpless transfer from fActualSpeedLast = fActualSpeed; //manual into PID mode. } motor[OUT_1] = fOutputPower * DIR_1; //Set motor power, recognize motor wiring direction. #if MOTORS == 2 //motor[] accepts floats (rounded >down< to integers). motor[OUT_2] = fOutputPower * DIR_2; #endif }//while (true) }//task PID_speed_control
-
Sound in LEGO PF Trains
Hi Sal, I looked up the LEGO PF RC document, I guess this is what you are referring to, right? 1) You can control C1 and C2 individually, but not the 9V and 0V line (That would break the daisy chain link, 9V is always connected to the power supply, could be a battery box or rechargeable (+) as well as 0V (-). That would give youo control of the bell and horn. 2) Be aware though that the PF receiver output is not analogue voltage corresponding to the power level, but pulse width modulated (PWM). Power level "1" = short pulses of +9V, power level "4" = longer pulses, and full power = always on. So when you want an analogue voltage in some way proportional to the power level, you need to rectify the pulses, as I said before (Bridge rectifier + capacitor + your generator as load?). 3) Withe what I said in 1): You could hook-up the bell to C1 and 0V and the horn to C2 and 0V. That would give you control of both with one output, the sound + motor with the other. 4) See above. 5) Well, so far TLC has not given us any other device than the NXT/HiTechnic IR Link that I know do the magic to control the set-up sketched above. It should be possible though. I coudl try and do such an experiment (NXT + IR Link + PF receiver + pin control), would take a little time though. Regards, Thorsten
-
Sound in LEGO PF Trains
I guess I am lost here, sorry, my fault: 1) What do you exactly mean by "single pin mode"? 2) Sound: If you want to in/decrease the sound level with speed setting, then you would need to somehow need to "read" the PWM outputs of the IR receiver. You could use a bridge rectifier (good for both fwd and bwd) + capacitor (+ possibly small load resistor) to get a "PWM power level corresponding DC voltage". I presume the response would be pretty much non-linear though (as you can see by attaching an old 9V lamp to the IR receiver output: Even at PWM power level 1, the lamp is already pretty bright) 3) The horn and bell module would work with the on/off remote, as long as this sound module goes off when powered on. During that time though, it would be tough to transmit other IR signals. 4) You may control many things individually, that would require more IR receivers (and naturally "block" IR channels of course) 5) NXT: This is something I am looking into. The NXT along with a HiTechnic IR Link sensor would be able to mimic both remotes, as well as transmit IR signals on more than one channels "quasi-simultaneously". But you are right: The NXT is still expensive, even at BrickLink, and the IR Link Sensor would be another 50 bucks. I just happen to have the NXT since 2 years now - was a present. Well maybe I am totally wrong here and you are talking about something entirely different. Regards, Thorsten
-
LEGO Train control using RCX1.0 PBricks
Dear All, I have uploaded a video on YouTube showing some LEGO trains equipped with RCX PBricks running on one larger stretch of track: Control is via IR messaging from a PC program talking/listening to the LEGO IR tower traffic. A simple ID/databyte message exchange protocol adresses individual trains on the track (or all). The track is powered with 9 ... 18V DC, as one sees fit. The PBricks are all RCX1.0, pick up power from the tracks via modified 9V trains motors and deliver power back to the motors. The RailBrick Journal Issue 3 (Page 44 and up) has some more information. The program running on the RCX and some other details are also available on the RailBricks website (see building instruction section, Diesels, GP40_RCX). It's up to you what the trains do, just program that into the RCX. I am simple minded, so power level setting 0 ... +/-7 (compatible with the 9V speed regulator, I love compatibility), some power level ramping (internally on the RCX, which allows 25 power level settings for each direction, looks more realistic when going from 0 to 5), head light on/off, some sound generation, and PID speed control (that IS fun!) is what I came up with. I am working on getting the NXT PBrick to be of any value here ... Rock on, Thorsten
-
Sound in LEGO PF Trains
Hi Sal, the LEGO "bang-bang" PF IR remote (#8885 S&H) should do what you want. As long as you "push" one of the buttons the corresponding output on the receiver is turned on @full power (no PWM, the output is plainly delivering full DC voltage). Regards, Thorsten
Sponsored Links