Open source LEGO Power Functions Receiver
This page is the home of the open source power functions receiver for LEGO Power Functions. Originally, I started out just wanting to make a receiver for the LEGO power functions remote, and thought it could be done in a month, and that I’d be happy ending up with a simple prototype. In the end, the protocol holds some nasty coding challenges, and I made my life very difficult by cramming a receiver with 4 outputs (2x PWM, 2x servo) in a 2x4x1 brick whereas the original receiver is 4x4x3 and features 2 outputs. Although I made this receiver VERY small, the code runs fine on a DIP microcontroller as well. You might even consider porting this code to another microcontroller, or change the code and read out the messages with an Arduino, or… or…. it’s open source!
*NOTE* Due to changing of the motor driver, the schematics are no longer up to date. I’ll update them soon.
The Gerber files and board / schematic (Eagle) for the receiver can be found here. If anyone is interested in a through-hole version drop me a line and I’ll see what I can do for you.
Partlist:: See below
LEGO Receiver – 6 times smaller, twice the outputs
Jump to ‘build log’ for latest news
The purpose of this project is to add Lego Power Functions to more DIY Lego building products. When I saw the specification was published openly by LEGO, I felt the urge to do something with that info. I also found the ‘default’ LEGO receiver (8884) to be too bulky to build nice minifig scale projects. From my background as electronics engineer I felt the receiver could be made smaller. The ultimate goal would be to jam all necessary electronics in THE Lego Brick, being the 2×4 default brick. One of the sacrifices to reach this goal was to remove all connectors, and connect motors, power supply etcetera with soldered wires to the LEGO brick. For now, that is the status quo. The schematics and PCB files are open source and downloadable, so if you wish to create a new, larger form factor go ahead and please publish the results, if needed contact me and I’ll place the files on my site.
Open Lego Power Functions receiver features
- Support of v1.2 Power Functions protocol
- Channel selection by using tactile switch on side of brick; last channel used is remembered between power offs.
- simultaneous servo and PWM output
- 1000mA 5V regulator to provide power to servos (NXP NX1117C50)
- Size: standard 2×4 LEGO brick
- connections for external power supply, 4.5 to 16V
- 2x 1400mA PWM output @ 14kHz (DRV8835 driver)
- NO power down mode! (bug or feature?)
Will this be the end of the commercial LEGO receiver?
No way! This project is a hack in the sense that it shrinks the existing receiver by a factor 4 while adding functionality. The very nice LEGO connectors are not provided though, you’ll have to buy LEGO cables (8871 or 8886), cut, strip and solder them to use LEGO motors. I might think of a larger form factor in future to make this more convenient. In pricing, this is not a ‘cheaper’ alternative. Although part pricing is about half of the unit cost of ’the’ LEGO receiver, you’ll still have to make a housing, buy the PCB and solder the components to the PCB.
So why is this still a good alternative? At first, you’ll be able to add LEGO power functions in a more aesthetically pleasing way. At second, you’ll get servo control (using micro servos, not the big LEGO servos). That way, you could use micro servos in your LEGO to get better steering options for boats, cars, maybe even planes? And although some VERY cool builds excists with RC LEGO on minifig scale, none of those can use a LEGO RC handheld unit. I can’t wait to see the first minifig scale car steered by a LEGO remote control. But that might just be me
Schematic and Layout
*NOTE* updated schematic and layout will be published!
Tested Remote Controls
8879 (dual jog) and 8885 (dual joystick) were tested and received OK. See ‘measurements’ section on description of protocols used by each transmitter.
Background info on internals
Note: this section is not interesting to you if you’re not interested in the hardware design. If you’re a non-ElectricalEngineer LEGO builder, please read on if you’re interested, but do not feel obliged to understand this.
- The receiver uses a TSOP4136 infrared receiver. This is one of few receivers easily commercially available that has a minimum burst length of 6 cycles
- The microcontroller is an AVR attiny44A. This device is small enough, and packs enough peripherals to program the protocol. The program is too large to fit in its smaller brother the attiny24A, but should be able to run in the attiny84A (not tested). Peripherals used: external interrupt, timer0, timer1, pin change interrupt, EEPROM. The servo connections are also used for programming through SPI. If DebugWire is used (requires AVR Dragon of JTAGICE), servos can remain connected, as this leaves the servo pins unused during programming / debugging. pins were mapped for convenience in layout, and minimum external connections while maintaining a full feature set
- The motor driver is the DRV8835, a dual motor controller in an incredibly small housing. Earlier, I tried using another motor driver which crapped out on me each time the motor should start. This one performs better.