Building the Receiver


After some comments of Mahjqa I’ve changed the default cabling and added a reverse power protection circuit. First impression is good. Also, I saved myself a lot of headaches to change the programming connector pinout to the standard Atmel ISP pinout.

For the end users the greatest change is that LEGO power functions cables can easily be soldered into the board, AND these have the power connection as well! In the original design I hadn’t thought people would like to use the Power Functions cables because they’re bulky, but I was wrong. Now you can also hook up PowerFunction servos!

New receiver circuit board – Now with power on terminals!



Open PowerFunctions Receiver for Mahjqa

Hooray! I finished my troubles with the motor driver. I switched to other types (first something from TI, then back to ONsemi again with a different type) to solve my issues with resetting the driver, if anyone is interested I can provide you with details… For now I’m happy I can finish the receiver I was planning to build for Mahjqa, as I would have liked to finish it weeks ago…


The last few weeks I’ve been trying to control the LVM8548 to NOT shutdown the outputs; I tried several schemes, from resetting the driver once in a while to adding series resistors to the output to nog driving the outputs continuously high when going full throttle to … leaving the LVM8548 at rest; The problem is that the automatic restore is not functioning, you have to restore the driver by pulling all inputs low. In normal behavior this happens once every pwm cycle when you’re pwm-ing both inputs. When one input is constantly high (full throttle forward / backward) the driver does not reset. There is no way to check whether something is going on. Now I’ve switched to the DRV8835 from TI. The part is ridiculously small, and I bought a hot air soldering station to be able to solder it, and made a new layout. The preliminary results are promising, although a direct connection of the motor to the outputs still shuts down the driver. A small inductor in series (‘chokes’ the inrush current) helps, I’ve ordered some ferrites to test, and hopefully that will be the end of redesigning.

I’ve been messing around with some software issues lately, had a tough time trying to find a bug in my code where the output pwm duty cycle of one channel depended on the state (on/pwm/off) of the other channel. The reason was that the 8548 driver is ‘reset’ when all 4 inputs are low, and needs an extra 7us to start up when inputs are asserted. Now, when I’m pwm-ing both channels, at the end of one period both channels have been set to ‘float’ e.g. all inputs low. When re-asserting the inputs, the motor driver needs an extra 7us to start. This is roughly 10% of the complete pwm period, so it was clearly noticeable. Fixed this in software. Will be testing more elaborately soon….





Gutted a lego brick at tkkrlab, and cut the bottom off to fit a regular LEGO plate at the bottom. The space left inside is minimal. Very curious how this will work out mechanically.


PCB’s have arrived from ITeadStudio! I didn’t take into account the ribs inside the LEGO brick, so it fits nearly when removing all ribs. I might try to do a redesign to make it fit easier. Now I’m waiting for the components to arrive…

Lego PCB still in tape. Two other boards for size reference.


13 thoughts on “Building the Receiver

  1. MiliKiller says:

    Hi, this project is realy cool.

    I making on lego controller board too, but my board is a litte bit bigger than yours. Its universal bluetooth reciever with remote programming over bluetooth via bootloader… Now i making on internal programming languague for automation in simple models.

    It has:
    2x PWM out 800mA per chanel (L293D) PTC protected
    10x Servo channel / 8bit resolution
    4x Analog Input / 10bit resoulution
    3x Digital output 10A per output
    4x Digital Input

    I plan build controller like yours, but with 4 PWM chanels and 2 servo outputs, input with IR (lego PF protocol) and bluetooth… But now i stuck in drawing PCB, i use DRV8835 as pwm driver, it is realy good driver, but it is realy tiny…

    What PWM driver you are now using? You are writing something about problems with DRV8835, and problem with sleep at LVM8548. Thanks for reply

    • admin says:

      Hello Milikiller,
      I’ve taken a short look at your projects, they look really nice, I like the TFT pictures!
      The driver I’m using now is the LB1948MC-AH, which is a TSSOP10 package (5x6mm).
      Previously, I used the LMV8548, but had problems with an overcurrent protection that was not mentioned in the datasheet. Because of the high inrush current (>2.5A for a few microseconds) of the brushed motors this protection kicked in and disabled the driver until all inputs were cleared again. Because I had no way to find out when this had happened, I could not use the device. Another finicky thing about the 8548 is that it enters a ‘low power’ state when all inputs are low. Starting up from this reset state takes a few microseconds, but has a large influence on the PWM you apply. I then went to try the DRV8835, which at least kept on trying to start up the motor after an overcurrent condition, but since it waited too long in between trying the motor couldn’t come to speed, and each time the driver tried to start up the motor it failed again.
      I then received word from ONsemi on the not-documented overcurrent protection, and they mentioned the LB1948MC-AH. This device uses BJT’s (‘normal’ transistors) and not FETs as the other devices. The trade-off is that the LB1948 does not have the protection and has a lower maximum continuous current rating (800mA instead of >1A), but it does get the motor to run. I guess it could be a good device for you too, another possibility being the motor drivers of TI with adjustable current limit, especially meant for brushed DC (like DRV8333). For me, the key requirements was to get 2 motor drivers in a very tight space; if you have the possibility of using more space, or a separate driver per motor, you have a gazillion more options!

      Good luck,

  2. milikiller says:

    Thanks for quick reply. I look at datasheet of DRV8333 its looks great but I need 12V motor voltage. I using 3s LI-PO as power source. I try to buy some DRV8333 and try it.

    Where do you make PCB? I using toner transfer method and etching board at home, but quality of this board is not realy good. Now I need through hole plated, double sided board, in my country is profi making of board realy expensive. Sorry for my bad english

    • admin says:

      Hello milikiller,
      Both onsemi and TI have many options for motor drivers, take a look at both their sites.
      I’m ordering my PCB’s at iTeadStudio, I also have good experience with OSHPark (although shipping is more expensive to Europe)

  3. Walter says:

    I’m very interested in the latest Power Function Receiver model posted on 10-11-2012. I would like to use it for motorized 7895 switching tracks working with a PF medium motor.
    How can I easy construct myself or get somewhere such a nice and tiny PF Receiver?
    Kind regards, Walter

    • admin says:

      Hello Walter,

      I’ll send you an email with more details!

      • Oleksiy says:

        Dear Tinkerer,

        I would also like to construct of get such a receiver. As my version works like this: I have built around ATTINY85 a device which receives commands over bluetooth LE from my remote and then simply repeat them to a standard LEGO PF receiver via low power LED (my device located in the vicinity of LEGO receiver on the model). So my idea is to get rid of unnecessary link: LED on ATTINY and optical sensor in the PF receiver. I think it is possible by combining your device and what I did.

        Kind regards,

  4. ondrew hartigan says:

    If you can figure out a way to make this work with RC instead of IR I know quite a few people who would be interested especially if you can provide a way to provide more than 4 communication channels. Perhaps using dip switches like in older garage door openers to pair transmitters and receivers would work. Obviously the device would be larger than a 2×4 brick but even a 4×6 brick would be a welcome size. I personally would be interested in 15 receivers for use with my trains and train accessories alone.

  5. Tom says:

    I like your reciever.
    I would like to build one for this car.
    My son get the right parts for Christmas gift (not the electric part yet). I would like to change the reciever to make this car more durable. I have problem understand what file I need to build functional part. Can you send me this to my email? Or do you have any practical advice?
    Thank you very much.

  6. Dennis says:

    Hi, great project !

    I like to build your latest Design from 10-11-2012.

    Can you send me the latest Eagle Project please.

    Greets from Germany


  7. Dieter Meckelburg says:

    I am the grandfather of avery fanatic 13 jers old LEGO-boy.
    Yesterday I found Your wanderful IR-Receiver-project and now, my grandson and I want to build such nice small receiver.
    Is it possible to buy 5 board and perhaps programmed processors.
    Greetings from Germany

  8. Grag says:


    I have a question about PCB. I try to make similar project and have a trouble exactly with PCB. i can’t install 0.3 mm connector on it. I used this one and maybe the problem is in it? Can you advise me something?

  9. D. Maeckelburg says:

    congratulation to Your wonderful project!!

    I am the grandfather(71) of a very activ LEGO-fan(13).
    Last autumn I found Your ir-receiver in the WEB.
    After studying the publication, I decided to do this job
    as a Christmas present for my grandson.

    In November I got 10 boards, later I got the components then the difficult soldering and programming the µC.
    All receivers are running.

    The SERVO-Output is 0,8ms-1,9ms,repetition-time ~20ms.
    The MOTOR-Output starts in the first step of the transmitter with 18µs pulse-with, repetition-time ~70µs in increments of 8µs until dc.

    The motor runs in the first step faster than in the original system. That’s not so good for slow movings.

    Can You help me, because it’s very difficult for me, to understand Your software.

    Thanks a lot for the Project and Your help
    D. Maeckelburg

Leave a Reply

Your email address will not be published. Required fields are marked *