Sign in to follow this  
Bartosz

Powering trains with 2xAA and custom IR receiver

Recommended Posts

Seeing couple of threads where people tried to electrify smaller builds to work with PF, the most problems were:
* 9V batteries, which fit nicely, but have low capacity
* bulky IR receiver

I started toying with idea of using some small ATMega chip with IR receiver and powering everything by 4 AAA batteries, which then could be divided into two battery boxes for greater flexibility. But then I've stumbled upon following video, where they've suggested step-up voltage regulator with AAA batteries:

After more googling and conducting some calculations, I've arrived at quite nice values: suppose we have 2 AA rechargeables, with 2600mAh, and we connect it to 5V step-up converter:

  2 * 1.2V * 2600mAh = 6240mWh

  6240mWh / 5V = 1248mAh

and finally, apply the efficiency (about 80%):

 

1248mAh * 0.8 = 998.4mAh

so about the same as with AAA rechargeables!

So far so good, so let's see what can we do about this bulky IR receiver. Following http://www.hackvandedam.nl/blog/?page_id=547, it seems we need 4KB of flash memory on our chip, so author used ATTiny44a. Now, I don't want to fuss around with custom boards, I just wanted to plug everything with wires (some soldering might be in order, but I'm not proficient enough to make any board for it), so I want to use DIPs. ATtiny85-20PU could be the right choice.

Obviously, chip can't drive the motor directly, so a motor driver like L293D (max 1.2A) would be used. Or better: SN754410NE.

For the voltage regulation, something like https://www.pololu.com/product/2564. It handles minimum input of 0.5V (other regulators require minimum of 2.5V, which might not be achievable with rechargeable AAs), and maximum current of 1.2A (I keep to mention this current, because according to specs from Philo's homepage, the motor stalled current can be up to 1.3, but that's for 9V).

Now, add the IR receiver (38kHz): TSOP4838.

The page for voltage regulator mentions it would be safe to install the capacitor to prevent from sudden voltage spikes.

So, my idea would be:

1. Connect the batteries to step-up regulator, from that the resulting 5V would go to:
  a) motor (via driver)
  b) ATtiny

2. ATtiny would be connected to
  a) IR receiver (not the LEGO one!) - operating at 5V
  b) L293D driver, the same 5V level would be used for the motor supply voltage, and for logic supply voltage

Questions to those more electronically inclined: Do you predict any problem with such setting? Have I missed something?

 

Edited by Bartosz

Share this post


Link to post
Share on other sites

I like the idea, but keep in mind that the voltage Lego runs the PF system at is 9V (six 1.5V AA or AAA cells in series), so I'm not sure that you would even be able to get your train motor to run with a 5V supply under load.

In addition (and I'm not sure since I haven't finished breakfast), you need more than the two PWM-capable output pins on the ATTiny85 to emulate the different speeds that the Lego IR receiver can produce - you will need four PWM-capable pins, so the ATTiny85 won't work unless you're fine with only being able to go full speed ahead and full speed backwards, similar to the standard PF controller.

However, the ATTiny85 does (barely) have enough pins to make this work if you're okay with the above: four output pins for your chosen motor driver chip, one input pin for the receiver, and the three remaining pins for GND, VCC, and Reset adds up to the eight total.

I'd recommend a second step-up converter to produce a motor voltage of 9V, but then your runtime goes down even further. 6240mWh/9V gives me ~693mAh of capaxity. We also can't forget the power draw of the microcontroller, the IR receiver, and the motor driver chip.

A quick internet search shows me that 9V batteries have capacities of around 500-600mAh depending on if they're rechargeable or not, so in the end this may come out to be a wash in terms of overall runtime - but with more complexity since you have to step up to two different voltages, instead of stepping down once from 9V to 5V.

 

Share this post


Link to post
Share on other sites
1 hour ago, Phoxtane said:

In addition (and I'm not sure since I haven't finished breakfast), you need more than the two PWM-capable output pins on the ATTiny85 to emulate the different speeds that the Lego IR receiver can produce - you will need four PWM-capable pins

That breakfast better be good! I think you need one PWM pin, its pulses define the speed. But youre right I need to investigate pins, as more are needed to control the direction.

 

As for the voltage - mind that 6 rechargeable AAAs you might have in your original battery box is 7.2V in fact. I think difference between 7.2 and 5V doesn't sound as scary as 9V and 5V. Check this: 

Not trying bigger step-up now - this whole idea resolves around powering everything with same 5V source.

Edited by Bartosz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.