[BeagleBoard] Beagle Battery Prototype

Prototype assembled and tested I have designed these 12 beagleboard battery prototypes. I have assembled one, and it actually has only a few small errors; none of which need rerouting. It actually works well, and i wrote a small code in C++ for the processor. You just wire up this board to your BeagleBoard with USB, and it will power it, and tell it the battery status and temperature through serial like so: [0,0,85,87,24] which is in [%,%,%,%,Celcius]. The four charging circuits also work fine, i am currently testing them and seem to work (now making some graphs).

This board has been to the stratosphere

This board was made for the Space Camera Live 1 project. In that project, it succesfully powered a beagleboard for over 10 hours, with half the battery left. It worked great and reliably.

I have 12 but only need 2

So i have 10 spare. If you want one, sure. One PCB is $5, shipping all over the world (envellope) is $2. So paypal me (timbobel@gmail.com) $7 or €5, include your adress and it’s on it’s way for you to solder. I’ll give you a BOM (schematics are in my other post about the beagleboard battery). In this way i make a $2 profit, so thanks for the coffee/beer!
[caption id="attachment_1206" align="aligncenter" width="300" caption="Module in the light. PCB is 1.6mm thick. Weight: 30g."][/caption]

Parts & Prices

All parts i used are pretty standard and cheap, except for the regulator. The regulator is a Picto TLynx DC/DC module that has very low ripple, very high efficiency (~95%) and can pump 6A. 6A at 5V means it can deliver 30W (!). That part is the most expensive and costs $13. One lipo chargerchip is $1, the processor and FTDI ~$6, and the rest (LED’s and resistors) costs next to nothing. The PCB itself costs $3. Total cost of the module ~$25. And then you have to assemble it too. It is super-super easy with just a heatgun. I bought a cheap one last week, and i did it well in one go using solder paste (see video). Almost no solder bridges.
[caption id="attachment_1209" align="aligncenter" width="300" caption="Bottom Assembled"][/caption] [caption id="attachment_1208" align="aligncenter" width="300" caption="Top Assmbled"][/caption]

Soldering the beast

Here is the video i did last night, takes 2 minutes, at 50x speed. That means i was busy a total of 100minutes (of which at least half was troubleshooting). http://www.youtube.com/watch?v=bGDonJKyJg4


All errors are actually very minor, and do not inflict the function whatso-ever. Miracle!
  • The RGB statusleds are reversed: they have common anode – i assumed common cathode. Solved: using just one led and place it in reverse (easy but no RGB πŸ™ ).
  • The ISP reset signal goes through a capacitor. Should go around this capacitor. Solved: short this capacitor the first time when burning bootloader on the processor.
  • The 22k pullup resistor on the ON/OFF signal from the V.reg should not be there. Solved: just leave it unsoldered.
  • The headers for the battery are spaced 2mm apart, should be 1mil. Solved: A normal 1mil header fits anyway.
  • When measuring voltage if switch is set to lipo, the first battery is measured fine, but the second one in series it measures including the first one. Solved: in the c++ program, just subtract the 2nd signal from the first one; like; 8.1V-4.0V=4.1V .
[caption id="attachment_1214" align="aligncenter" width="300" caption="Stacked under a BeagleBoard, enough to power the BeagleBoard (at 1Watt) for 48 hours."][/caption]

Charging test

This is a test i measured with the output of the module itself when it was charging one battery. It took a few hours to get from ~30% to 100%. You can see it nicely stopped charging at 100% (=4200mV). You can see the temperature of the regulator rising a bit during the high charge part in the middle, and rising again when it was done charging. I am not sure why that is exactly, but it’s nothing to worry about.

Battery duration test

I hooked up the module to the beagleboard, powering it for 10 hours when it still had not yet used half the juice (see above picture). The beagleboard was running though remote desktop, with which i let it use 100% of the CPU. As you can see, to my delight, the batteryboard did not get above 37 degrees, which means that the board runs very very efficiently (the temp sensor is right next to the voltage regulator).
[caption id="attachment_1228" align="aligncenter" width="300" caption="Duration test: 6000mAh from 80% to 40% in 10 hours on full 100% CPU"][/caption] [caption id="attachment_1241" align="aligncenter" width="300" caption="Discharge profile with small batteries"][/caption]

More charge tests

With lipo’s, charging is difficult and important. Thats why i test it now. The board can charge up to four independant batteries at max 500mA per battery. So i charged two 6000mAh batteries, and one 1000mAh battery. As you can see, the temperature remains fairly cold while even giving the batteries a total of 1500mAh.
[caption id="attachment_1229" align="aligncenter" width="300" caption="Charging three batteries at once"][/caption] [caption id="attachment_1234" align="aligncenter" width="300" caption="First batch to testers"][/caption]

I sent you a PCB: how do you assemble it?

Assembly was fairly easy, since i had the right tools. I bought a $100 hot air solder gun, and used solder paste. How to use that, check out youtube. Then, even soldering the tiniest of tiniest is super easy and VERY fast. I recommend the experience to all engineers and enthusiasts.

Using the little processor on board for battery monitoring

Also, this module has got a processor, the atmega 328P. I wrote a program for it in C++, it reads the battery voltages, shows it through the LEDs and gives it back to your beagleboard though USB. The only thing you have to do to get that to work is burning the arduino bootloader on the processor using the ISP header on the board. For that, you need a parellel processor, tiny isp, etc etc. These are very common. Burning the bootloader itself you can do with just one click through the Arduino IDE software. More to come during the week… [caption id="attachment_1236" align="aligncenter" width="300" caption="All small components are "1206" size"][/caption] [caption id="attachment_1237" align="aligncenter" width="300" caption="Green part is for battery-usb monitoring (sends battery info through USB) this is not neccesary for the unit to work at all. 2 is voltage regulation, 3 is battery charging stuff. You dont need to solder all four chargers; 2 minimum."][/caption] [caption id="attachment_1238" align="aligncenter" width="300" caption="How to burn the bootloader on the chip (using f.e. Sparkfun's Pocket AVR programmer; very easy)."][/caption]

Code to burn onto the chip for battery monitoring through USB

  1. #include <oneWire.h>
  2. #include <dallasTemperature.h>
  3. #define ONE_WIRE_BUS 12
  5. OneWire oneWire(ONE_WIRE_BUS);
  6. DallasTemperature sensors(&oneWire);
  7. //addr=284AC5AF02000028 (on first beaglebattery bèta prototype board)
  8. int pin_Bat1A=A0;
  9. int pin_Bat1B=A1;
  10. int pin_Bat2A=A2;
  11. int pin_Bat2B=A3;
  12. int val_Bat1A=0;
  13. int val_Bat1B=0;
  14. int val_Bat2A=0;
  15. int val_Bat2B=0;
  16. long mv_Bat1A;
  17. long mv_Bat1B;
  18. long mv_Bat2A;
  19. long mv_Bat2B;
  20. int blinks1A;
  21. int blinks1B;
  22. int blinks2A;
  23. int blinks2B;
  24. int led1A=2;
  25. int led1B=4;
  26. int led2A=7;
  27. int led2B=8;
  28. int pct1A=0;
  29. int pct1B=0;
  30. int pct2A=0;
  31. int pct2B=0;
  32. //for the moving averages
  33. int cnt=0;
  34. int av1A[5] = {0,0,0,0,0};
  35. int av1B[5] = {0,0,0,0,0};
  36. int av2A[5] = {0,0,0,0,0};
  37. int av2B[5] = {0,0,0,0,0};
  38. int temp[5] = {0,0,0,0,0};
  39. int tempAvg;
  40. boolean firstrun=true;
  41. void setup() {
  42.   Serial.begin(9600);
  43.   sensors.begin();
  44.   sensors.requestTemperatures();
  45.   delay(500);
  46.   pinMode(led1A, OUTPUT);
  47.   pinMode(led1B, OUTPUT);
  48.   pinMode(led2A, OUTPUT);
  49.   pinMode(led2B, OUTPUT);
  50.   bootleds();
  51. }
  52. void loop() {
  53.   measurebats();
  54.   //convert to milliVolts
  55.   mv_Bat1A=(long(val_Bat1A)*10000)/1024; //= 2x5x1000/1024
  56.   mv_Bat1B=(long(val_Bat1B)*10000)/1024;
  57.   mv_Bat2A=(long(val_Bat2A)*10000)/1024;
  58.   mv_Bat2B=(long(val_Bat2B)*10000)/1024;
  59.   if(mv_Bat2A>6000 && mv_Bat2A < 9000) //Double measure error
  60.   {mv_Bat2A=mv_Bat2A-mv_Bat2B;}
  61.   if(mv_Bat1A>6000 && mv_Bat1A < 9000) //Double measure error
  62.   {mv_Bat1A=mv_Bat1A-mv_Bat1B;}
  63.   if(mv_Bat1A>5000){mv_Bat1A=0;} //Occurs when not connected error
  64.   if(mv_Bat2A>5000){mv_Bat2A=0;}
  65.   //temp
  66.   tempAvg = sensors.getTempCByIndex(0); //Read previous (need delay)
  67.   delay(50);
  68.   sensors.requestTemperatures(); //Read temp for next loop
  69.   delay(50);
  70.   pct1A=getpct(mv_Bat1A);
  71.   pct1B=getpct(mv_Bat1B);
  72.   pct2A=getpct(mv_Bat2A);
  73.   pct2B=getpct(mv_Bat2B);
  74.   if(cnt<5){//Running average
  75.     av1A[cnt] = pct1A;
  76.     av1B[cnt] = pct1B;
  77.     av2A[cnt] = pct2A;
  78.     av2B[cnt] = pct2B;
  79.     temp[cnt] = tempAvg;
  80.     cnt++;
  81.   }else{cnt=0; firstrun=false;}
  82.   //Calculate averages of the array
  83.   if(firstrun==false){
  84.     pct1A=(av1A[0]+av1A[1]+av1A[2]+av1A[3]+av1A[4])/5;
  85.     pct1B=(av1B[0]+av1B[1]+av1B[2]+av1B[3]+av1B[4])/5;
  86.     pct2A=(av2A[0]+av2A[1]+av2A[2]+av2A[3]+av2A[4])/5;
  87.     pct2B=(av2B[0]+av2B[1]+av2B[2]+av2B[3]+av2B[4])/5;
  88.     tempAvg=(temp[0]+temp[1]+temp[2]+temp[3]+temp[4])/5;
  89.   }
  90.   blinks1A=getblink(pct1A);
  91.   blinks1B=getblink(pct1B);
  92.   blinks2A=getblink(pct2A);
  93.   blinks2B=getblink(pct2B);
  94.   blinkit(blinks1A,blinks1B,blinks2A,blinks2B,led1A,led1B,led2A,led2B);
  95.   if(pct1A==-1)pct1A=0;
  96.   if(pct1B==-1)pct1B=0;
  97.   if(pct2A==-1)pct2A=0;
  98.   if(pct2B==-1)pct2B=0;
  99.   //print_mvs();
  100.   print_pct();
  101. }
  102. void blinkit(int b1,int b2,int b3,int b4, int p1, int p2, int p3, int p4)
  103. {
  104.   for(int i=0;i<=20;i++)
  105.   {
  106.     if(b1>0)digitalWrite(p1, LOW);
  107.     if(b2>0)digitalWrite(p2, LOW);
  108.     if(b3>0)digitalWrite(p3, LOW);
  109.     if(b4>0)digitalWrite(p4, LOW);
  110.     b1--;
  111.     b2--;
  112.     b3--;
  113.     b4--;
  114.     delay(100);
  115.     if(b1<20)digitalWrite(p1, HIGH);
  116.     if(b2<20)digitalWrite(p2, HIGH);
  117.     if(b3<20)digitalWrite(p3, HIGH);
  118.     if(b4<20)digitalWrite(p4, HIGH);
  119.     delay(50);
  120.   }
  121. }
  122. int getpct(long mv)
  123. {
  124.   long pct;
  125.   pct=(mv-(3600))/6; //3600=0% 4200=100% (maps from mv to pct)
  126.   if(mv<2000){return -1;}
  127.   if(pct>100){return 100;}//Nothing above 100%
  128.   if(pct<0){return 0;}//empty
  129.   return pct;
  130. }
  131. int getblink(int pct) //gets number of blinks
  132. {
  133.   int blinks;
  134.   if(pct==-1) return 41;//Don't blink at all.
  135.   blinks=20-(pct/5);
  136.   return blinks;
  137. }
  138. void measurebats(){ //take 50 measurements for averaging
  139.   long m1=0;
  140.   long m2=0;
  141.   long m3=0;
  142.   long m4=0;
  143.   int iter=50;
  144.   for(int i=0;i<iter;i++)
  145.   {
  146.     m1=m1+analogRead(pin_Bat1A);
  147.     m2=m2+analogRead(pin_Bat1B);
  148.     m3=m3+analogRead(pin_Bat2A);
  149.     m4=m4+analogRead(pin_Bat2B);
  150.     delay(1);
  151.   }
  152.   val_Bat1A=long(m1/iter);
  153.   val_Bat1B=long(m2/iter);
  154.   val_Bat2A=long(m3/iter);
  155.   val_Bat2B=long(m4/iter);
  156. }
  157. void print_pct()
  158. {
  159.   Serial.print("[");
  160.   Serial.print(pct1A);
  161.   Serial.print(",");
  162.   Serial.print(pct1B);
  163.   Serial.print(",");
  164.   Serial.print(pct2A);
  165.   Serial.print(",");
  166.   Serial.print(pct2B);
  167.   Serial.print(",");
  168.   Serial.print(tempAvg);
  169.   Serial.println("]");
  170. }
  171. void print_mvs()
  172. {
  173.   Serial.print("[");
  174.   Serial.print(mv_Bat1A);
  175.   Serial.print(",");
  176.   Serial.print(mv_Bat1B);
  177.   Serial.print(",");
  178.   Serial.print(mv_Bat2A);
  179.   Serial.print(",");
  180.   Serial.print(mv_Bat2B);
  181.   Serial.print(",");
  182.   Serial.print(tempAvg);
  183.   Serial.println("]");
  184. }
  185. void bootleds()
  186. {
  187.   int ddd=40;
  188.   int p1=led1A;
  189.   int p2=led1B;
  190.   int p3=led2A;
  191.   int p4=led2B;
  192.   for(int i=0;i<3;i++){
  193.     digitalWrite(p1, HIGH);
  194.     delay(ddd);
  195.     digitalWrite(p2, HIGH);
  196.     delay(ddd);
  197.     digitalWrite(p3, HIGH);
  198.     delay(ddd);
  199.     digitalWrite(p4, HIGH);
  200.     delay(ddd);
  201.     digitalWrite(p1, LOW);
  202.     delay(ddd);
  203.     digitalWrite(p2, LOW);
  204.     delay(ddd);
  205.     digitalWrite(p3, LOW);
  206.     delay(ddd);
  207.     digitalWrite(p4, LOW);
  208.     delay(ddd);
  209.     digitalWrite(p4, HIGH);
  210.     delay(ddd);
  211.     digitalWrite(p3, HIGH);
  212.     delay(ddd);
  213.     digitalWrite(p2, HIGH);
  214.     delay(ddd);
  215.     digitalWrite(p1, HIGH);
  216.     delay(ddd);
  217.     digitalWrite(p4, LOW);
  218.     delay(ddd);
  219.     digitalWrite(p3, LOW);
  220.     delay(ddd);
  221.     digitalWrite(p2, LOW);
  222.     delay(ddd);
  223.     digitalWrite(p1, LOW);
  224.     delay(ddd);
  225.   }
  226. }

You may also like...

35 Responses

  1. Mark says:

    Does it have an on/off switch?

    • Tim says:

      There is a switch with which you can choose for power through Lipo’s or power through DC jack (the black switch on the board, see pictures). If you want to turn if off when you’re on lipo’s, just switch it to DC jack mode.

  2. German Viscuso says:

    Hi Tim.
    I need to ask some questions about the components. I believe I’ll do them here one by one so I don’t abuse of your time. First one:
    Are you using a resonator with built in cap? If that’s the case what’s the capacitance value?

    • Tim says:

      Yes it is a resonator with build in capacitors. Just take 8MHz or 16MHz (if you take differently you will mess up the baudrates). Also you can choose not to use the capacitor at all, but configure the chip to use its built in resonator, which is pretty cool, but it takes a little programming with the AVR programmer, and its not super reliable as the osc/res are. Anyway, in my experience it doesnt matter what the capacitance is. i use them without and it worked fine. But ofcourse, they recommend 22pf. Sadly though, Farnell (where i bought them) didnt show the capacitance values, so i just took three samples, which i all three tried, and worked. For instance, this one worked fine: http://nl.farnell.com/ael-crystals/c16m000000s004/resonator-sm-16mhz-cv/dp/1448145

      • German Viscuso says:

        Thanks a lot! That made things pretty clear. Here’s my next question. Switches. You have 5 switches in the board correct? 4 of them have 6 pins in 2 rows. The one to switch from ext lipo is a 3 pin switch (only 1 row). Are all these switches on-on? Do you have a reference to the 6 pin switches? (I don’t know where to get them)

        • Tim says:

          http://nl.farnell.com/jsp/search/productdetail.jsp?sku=1123870 (the image in the product is incorrect though). Its a two position DPDP switch. which means the middle one is always connected and it switched to either the middle and the left or the middle and the right.

          • German Viscuso says:

            Awesome! Thanks for the link. Let me continue with the questions (I’m almost done). You’re using 1206 caps all over except for the the 100uf and 22uf ones, right? Three more questions: what’s the nominal voltage of the caps? Can you provide a reference for the 100uf and 22uf caps (I’m not sure I have the right ones)? What’s with the supercap that you’re leaving out on the board, what should I use there?
            Best! Hopefully I’ll be able to assemble the board soon πŸ™‚

          • Tim says:

            For the 100uF caps i decided to use low ESR tantalum ones (the yellow blockshaped capacitors). Everything else is just plain 1206 the 22uF is panasonic case C (http://nl.farnell.com/jsp/search/productdetail.jsp?sku=1714693). For the 10uF i used a plain 1206 (http://nl.farnell.com/jsp/search/productdetail.jsp?sku=1754056). For the 100uF i like the capacitor case Y which fits fine on the other (panasonic round style) footprint i used. (http://nl.farnell.com/jsp/search/productdetail.jsp?sku=1658794). Note that these are fairly high quality original products. If you’re really into it you could buy a giant box full of SMD components for a few hundred bucks and you’re done for the rest of your life. These components are suuuuupercheap if you buy them in fair quantities.

          • German Viscuso says:

            Awesome Tim, thanks for the help with the caps! Are these components ok for the diode:
            and the fuse:

          • Tim says:

            correct. though i will admit, for troubleshooting i usually ignore the diodes and fuses. doublecheck my footprint, i always flip leds & diodes. Actually i had a batch of SMD leds that was produced the wrong way around (ebay.. ) so i had to desolder them again πŸ™‚ but that wasnt a big hassle with a hot air gun; just blow them away.

          • German Viscuso says:

            Great! This is probably the last one Tim (sorry to keep bothering you). With regards to the leds: It seems there’s no common cathode rgb leds for the package size you’re using on the board. Can I just use standard 1206 leds and sold them in a diagonal arrangement as you show in your board?
            Will these leds work for every led on the board?
            (not sure because voltage says 2V)

          • Tim says:

            Any 1206 led will do really, you have to check out what resistance they need to be yourself, this can be anywhere between 100ohm and 5kohm. And indeed, the leds are not a great succes, though it works great, you can control them individually if you hook them up as i did on the picture. By the way, its good that you ask these questions, then i only have to write it once =)

  3. German Viscuso says:

    Hey! =) How would you hook a solar panel to this board? Looks like it could be extended to accomodate charging the batteries from a solar panel. It would be perfect for my rover project.

  4. Tom says:

    Mooi werk, Tim! Heb je nog een PCB voor de batterij module en een voor de GPS SMS module beschikbaar?

  5. German Viscuso says:

    Hi Tim!
    I’m making good progress with the BeagleBattery, still in the process of soldering the components. I have a question the ISP programming of the ATmega 328p. It’s about the cap that needs to be shorted. By shorting you mean just bridging the two pads of the capacitor that you indicate with a simple wire and then replacing this wire with the cap after the chip has been programmed?
    I’ll use avrdude for the programming, which lines did you use for the programming (I’m interested about how to se the fuses)? And which Arduino bootloader did you use?
    Best!! (thanks a lot for the help)

    • Tim says:

      Hi German. Great to see that you are still on it. At least I am heaving a lot of pleasure from it. I have been able to power my beagleboard plus 4 perhipials on USB for >> 10 hours yesterday on two lipo’s. Now i just put it on charge, i like it a lot (though still you might as well get a laptop :). Anyway, i just put the arduino bootloader on it. When putting the boatloader on there you have to bridge the capactor=shorting it. Indeed, just make sure the capacitor is shortcircuited. I actually did that by hand – pressing “load bootloader” on the computer, and keeping my hands very steady shorting the capacitor for the next minute. After that you’ll never have to do that again. From that moment on, you can just use your USB connection to load your new programs on it. Bootloading the bootloader is easiest with the Arduino IDE, but you do need an AVR programmer, or, use another arduino with a bit of hacking. At least, you have to wire up the ISP header and use that for bootloading (after that you’ll never need those pins again). Personally i use this one http://www.sparkfun.com/products/9825, cheap and easy.

      • German Viscuso says:

        Great! It worked for me too. Which bootloader did you choose? The one for Arduino Nano?

        • Tim says:

          Ehmmm… yes, i always use that one. its 5V so make sure to use 16mhz, to be sure.i have no idea what resonator or oscillator you need, i ordered a
          few and they were all fine

  6. German Viscuso says:

    Hi Tim.
    Why are you using 22k resistors next to the top red led (for first battery) instead of 10k resistors as you do for the others?
    How did it go with SpaceCamera, you launched it today Sunday right?

    • Tim says:

      because with LEDs, especially cheap ones i have, you just have to tune the resistance to what looks good and even to you! πŸ™‚ that can be anywhere between 2k and 20k generally or something.

  7. Tim says:

    BeagleBattery has been to 36km altitude near-space in a weather balloon and worked fine for the full 12 hours!

    • German Viscuso says:

      Congrats! Now when I show the BeagleBattery I can say it went to space πŸ™‚ It’s amazing how the board can withstand the extreme condition of such altitude!!

  8. German Viscuso says:

    I just finished soldering everything and I run into a problem with the regulation circuit. I’m providing 5.1V as DC input to the BeagleBattery via the input mini usb connector but I get 0V out of the dc-dc converter. When I measure the voltage right after the diode (aka the converter input) it starts at around 0.7V and slowly goes up up to 1.1V and stays there. Do you have a clue on what the problem might be? (I left the 22k resistor unsoldered as you suggested)
    Best! (thx a lot)

    • Tim Zaman says:

      Hm.. Okay.. do note tha tone side of the board is for input (the one with the DC jack) and the other is for output (one with the 3 connectors). Well.. it could be, i had that, that the voltage regulator (which is pretty hard to solder) is not soldered on it well enough. Otherwise, if you solder every part as you see in the pictures i guess it should be fine. Or, maybe, there is a short somewhere?

  9. rafal267 says:

    what PCB manufacturer made you this one for so few money ?
    All manufacturers that I find on the internet would charge 50 to 100 $ for a similar board.
    thanks and regards,

  10. Giovanni Genna says:

    I have seen your projects, you are very crazy and very intelligent. Good work!
    well, I have a begaleboard XM , I need portable power supply, Can I try your battery prototipe? I buy one or two modules (complete !).
    But maybe thath a little problem.
    In the picture I note that you power supply your beagleboard by USB OTG.
    I already make sure that is not sufficient this power, It ‘s necesarry power by 5 Volt (with 800 mA capability)
    thanks in advance
    attend your response
    best regards
    Giovanni Genna

    • Tim says:

      Hi Gionvanni !Thanks for the interest, but i do not manufacture them assembled. Do note that my BeagleBattery powersupply regulates power up to 6A (6000mA!) on 5V. And the usb input can indeed take up more power than you state. Though, it can not supply more in turn itself.

  11. Do you still have any of these boards available?

  12. David D says:

    Do you still have any beagleboard xm battery packs? I am doing a school project and I need one really bad and in a hurry.

  1. June 19, 2011

    […] [BeagleBoard] Beagle Battery Prototype […]

  2. September 20, 2011

    […] a proper “Beagle Battery” module. How i made that or make it youself you can read that here. To use the GPS/GPRS system on the beagleboard, i made a proper module that you can read about and […]