LEGO power fucntions beginniner

Hi guys,

I have limited programming experience however i am trying to control the 60051 LEGO high speed train with Arduino Uno, IR LED and IR receiver. Im not sure how you use the transmitted signal from the IR LED to communicate with the train.

Any help is much appreciated!

From my quick Google, it seems the Lego train is already controlled by IR, is that right?

If so, I'd say the first thing is to understand what signals are sent from its IR remote, ie what protocol (set of rules) it uses. That may be documented somewhere......

If not, one way to try to decode the signals is to use Ken Shirriff's library, here. But you would have know the frequency of the modulated signal: that may or may not be documented. You could take a stab at using 38kHz since that's quite common, and get a 38kHz IR receiver.

Then you would need to design a program to get the Arduino to transmit the right codes from an IR LED.... but that step's a long way off if you need to decode the real Lego signals first.

Thanks for the reply

I have the 38 KHz IR transmitter and i think i was told that would do the trick... so i don't think i would need to decode the signals from the LEGO. Im struggling with using the transmitted signals to drive the LEGO motor using the LEGO power functions library

OK well now I'm confused about what's connected to what and what's trying to communicate with what. Time for a pic I think....

I have the example code from the LEGO power functions and the IR remote library but not sure how to say if IR Receiver is high (for example) then move.
one pic is the Arduino setup, the other is the LEGO train setup.

these are the images

the arduino setup

Sorry but from those photos I still have no clue what you're trying to achieve.

It's not the least bit clear to me, what's supposed to be talking to what and what's supposed to happen.

Sorry for the poor explanation.

i am using the setup on here IR Communication -
i want to use this line

irsend.sendRaw(rawCodes, codeLen, 38);

to transmit the last code it stored when a little push button is pressed, im not sure where to place this line.

Kind regards

IRrecord_LED.ino (5.25 KB)