How is that old adage? A picture is worth a thousand words?
Okay, it's just a excuse - I'm a lazy bum.
How is that old adage? A picture is worth a thousand words?
Okay, it's just a excuse - I'm a lazy bum.
So, let's say that you want to use your Arduino board with a LiPo battery. What would you have to do?
WARNING: If you have never used a LiPo battery before, I strongly advise you to read this guide before continuing. This guide will teach you the basic safety precautions required by this kind of battery.
If you do have the money for it OR if you don't fell comfortable working with the steps that I'm writing below, I suggest you buy a board that already has a USB LiPo charger embedded, like an Arduino Fio* - the only practical difference between this board and what I'm presenting here is the more expensive price and the impossibility to use it @ 16Mhz without modifying the board.
Since I'm always concerned with simplicity, I'll only suggest already tested and safe modules. We don't need to reinvent the wheel, do we? This is just a simple Arduino power guide.
| Charger/Booster | LiPo, 1S1P | Micro USB-B Cable | JST RCY Connector | 2pin molex |
Why use a "low discharge" battery and what the hell is that? The discharge rate is simply how fast a battery can be discharged safely, suffice it to say that we don't need a battery with a high discharge rate (the normal type out there) for devices with low consumption. Our Arduino is a low consumption device (it requires 100ma, tops) so a low discharge rate battery is more appropriate, safer and it will drain slower than a normal battery. If you want to know more about LiPo Batteries, take a look into this link.
This is the basic wiring to power up any Arduino board running at 5v (pictures 8 and 9). It's important to note that we are wiring the charger's output straight into the uC and it's not passing though the internal voltage regulator (the LM whatever LDO). That being said make sure to use only 5v regulated power sources otherwise you will melt your little friend.
The booster is also available in a single module, without the LiPo charger:
The Sparkfun's USB LiPo charger/booster used above can be configured to work at 3.3v, you can see how to into its guide, doing so you will be ignoring it's embedded booster circuit. For this scenario it's better to use one simple LiPo charger instead - cheaper and smaller.
| Charger | 5v Booster | Another Charger | More Charger |
At this point you did powered you Arduino however you didn't wired the USB data pins (D- and D+), there's no such pins in the LiPo charger nor in the 5v booster - both modules don't care about these signals. They could have designed these modules taking into account these pins but they didn't. Why? I think they are just assuming that you are only using the USB cable to charge your LiPo or to provide power to your device, not to communicate with your computer (silly assumption).
To enable the USB communication you will need one USB 2.0 header like the one I did here.
continue ...
Sometimes you will need a way to identify when the device is been powered by the USB or been powered by the LiPo. This is not required but it will help some wireless applications (if you don't need or don't have a clue why an wireless application would require it just wait my next post - when I'll wire a bluetooth module to one LiPo powered Arduino).
The easiest way to identify when the board is been powered by our LiPo is to check the USB 5v presence. You will need one 100k resistor, one wire with 2.54mm headers and one USB 2.0 header.
/*
USB 5v –> 100k resistor –> Arduino A5.
Blink when powered by LiPo.
*/
#define DEBUG
// Pin 13 has an LED connected on most Arduino boards.
int led = 13;
// Analog 5 will be used to read the vcc line voltage.
int vcc = A5;
// the setup routine runs once when you press reset:
void setup() {
Serial.begin( 9600 );
// initialize the digital pin as an output.
pinMode( led, OUTPUT );
}
// the loop routine runs over and over again forever:
void loop() {
int vccA = analogRead( vcc );
float vccR = vccA / 204.6;
#ifdef DEBUG
Serial.print( "VCC Voltage: " );
Serial.print( vccA );
Serial.print( " - " );
Serial.print( vccR );
Serial.println( "." );
#endif
digitalWrite( led, HIGH ); // turn the LED on (HIGH is the voltage level)
delay( 1000 ); // wait for a second
if( vccR < 3.3 ) {
digitalWrite( led, LOW ); // turn the LED off by making the voltage LOW
delay( 1000 ); // wait for a second
}
}
204.6? what's that? Take a look into the documentation of the function analogRead and try to figure it out by yourself as a mental exercise.
So, do you want to project and build USB devices? Something like one USB scale? one LCD display? or one special type of keyboard? So do I! Lets just say that today it's not that hard - with the proper uC and library you can build simple devices in just one day without much headache (Thanks to all that hard work done by the the open source community!). Welcome to my "online procrastination USB project learning share experience" ...
Don't get too much excited thought, we will just scratch the surface here (that's why I said "simple devices"). If you want to go deep into the USB devices be prepared for some long time reading books, specs and lots and lots of coffee - the USB spec is hard core (IMHO) - actually it is one of the the most complex protocols out there and it will take a while to learn all stuff required to make pro gadgets.
So, Hey Ho, Let's Go! let's see the arsenal that will help you to create your first awesome USB gadget:
uC Library | uC Family | hex Size | USB | Licensing |
USBTiny | ATTiny / ATMega | +- 1350 bytes | 1.1 low speed | GPL v2 or later |
V-USB | AVR | +- 1400 bytes | Fully 1.1 compliant low-speed | GPL v2 or commercial |
LUFA |
As far as I can tell the Teensy board was one of the first ATMEL based prototype boards with USB support
The Arduino Mega ADK is nothing more than the Google ADK main board without that cute test board (the google ADK sold out in the first month). This board is based in the awesome work done by Oleg.
This creature is not totally ready yet and, please, fell free to post your comments and suggestions to feed this Tamagotchi ...
I was looking for one Google Sketchup plugin to convert objects into G-code when I bumped into another project that called my attention: One USB Servo Controller.
This project is not using LUFA, they are using another USB stack (I didn't know this one) and it claims to be smaller and simpler than the well know LUFA above
And yes, I found the g-code sketchup plugin here.