[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!

Module in the light. PCB is 1.6mm thick. Weight: 30g.

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.

Bottom Assembled


Top Assmbled

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).

Errorlist

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 .

Stacked under a BeagleBoard, enough to power the BeagleBoard (at 1Watt) for 48 hours.

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).

Duration test: 6000mAh from 80% to 40% in 10 hours on full 100% CPU

Discharge profile with small batteries

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.

Charging three batteries at once

First batch to testers

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…

All small components are "1206" size

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.

How to burn the bootloader on the chip (using f.e. Sparkfun's Pocket AVR programmer; very easy).

Code to burn onto the chip for battery monitoring through USB

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

Tim Zaman

MSc Biorobotics. Specialization in computer vision and deep learning. Works at NVIDIA.

You may also like...

35 Responses

  1. 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.

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

    Thanks

    Conrad

  3. Giovanni Genna says:

    hi
    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
    Italy

    • 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.

  4. rafal267 says:

    Hello,

    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,
    rafal

  5. 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)

    German

    • 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?

  6. 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!!

      German

  7. 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?
    Best!
    German

    • 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.

  8. 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)
    German

    • 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

  9. Tom says:

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

  10. 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.

  11. 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?

    Best!

    German

    • 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)

        Best!

        German

      • 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 πŸ™‚
        German

      • 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:
        http://nl.farnell.com/jsp/search/productdetail.jsp?sku=1651133
        and the fuse:
        http://nl.farnell.com/jsp/search/productdetail.jsp?sku=1861194
        ?

      • 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?
        http://nl.farnell.com/jsp/search/productdetail.jsp?sku=1466000
        (not sure because voltage says 2V)
        Thx!!
        German

      • 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 =)

  12. 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.

  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 […]