Go Down

Topic: Lego powerfunctions library (Read 2343 times) previous topic - next topic

SuperCow

I've made a library to control the lego powerfunctions receivers.
Its using IR so you only need a arduino and a IR led.
A nice extra is you can do PWM control on the motors, the lego RC cant do that.

There is an example included with a program that emulates the RC from lego.

http://www.rjw.speedxs.nl/arduino/LEGOPowerFunctions.rar

Bare in mind, this is my first library so if you have suggestions, better code optimization tell me :)

SuperCow

#1
Apr 24, 2009, 12:52 pm Last Edit: Apr 24, 2009, 01:40 pm by SuperCow Reason: 1
I have made a update, removing some bugs.
I've also made a joystick from it.

http://www.rjw.speedxs.nl/arduino/front.jpg
http://www.rjw.speedxs.nl/arduino/print.jpg
http://www.rjw.speedxs.nl/arduino/inside.jpg
schema: http://www.rjw.speedxs.nl/arduino/arduino-joystick.bmp

To make the IR pulse i used the function: oscillationWrite from David Cuartielles
with a delay of 13us should make 38khz frequent.
But this is not the case, I've put it on a scope, and its about 28khz.
So i have lowered the timing to 9us.


WilkoL

Hi,

Tried your library and it worked on the first run. A few questions though, why didn't you use a timer to generate the signals for the IR-Led?
And could you give some comments on the LEGOPowerFunctions::message_pause, I don't understand where the calculations are for.

Thanks.


jopiek

This is a nice one!!! Thanks a lot, it will be great to control LEGO PF Trains etc.

sciguy

#4
Mar 15, 2010, 12:46 pm Last Edit: Mar 15, 2010, 02:24 pm by amacmullen14 Reason: 1
Cool!  I ordered one of those speed control remotes, but it's backorded till next month.  (just the estimate, probably will come earlier)
Even when I recieve it, I could still use the arduino.


Mindstorms cheap replacement?

Edit:  Just got it working to power remotely my EPD.  (Entirely pointless device)
It is a small device that fits on a desktop.  The powerfunctions battery powers 2 XL motors, which turn cranks, which pump lego pneumatic pumps, which activate lego pneumatic cylinders, which switch their own valves, moving up and down repeadedly.  It's a completely inefficient and convoluted way to get two rotating reciprocating motions from one device!
Now I just have to have the cylinders reverse the direction of the motors, making a huge cycle of pointlessness!
Soundcloud page: http://soundcloud.com/beefinator-2
Youtube channel: http://www.youtube.com/user/beefinator14
Old soundcloud page (ran out o

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy