What I want to do is a USB charger using a 7805, a type-A female USB port and powered by a cell phone charger. You see a lot of howtos - for example on Instructables
I'll need it to charge a keychain spy cam (google image search
). But additionally I want to control the charging cycle using an Attiny85. This Attiny85 will set the 5V output to the USB on or off - triggered periodically or by some sensors.
So the 5V output from the 7805 would power the Attiny85 and the USB port.
I don't know how to switch the 5V to the USB on and off. I have some 2N2222 lying around, but is this advisable? According to this datasheet
it can handle more than 5V and up to 600mA. I guess the spy cam won't draw more than 500mA...? I also guess it is out of the question using an optocoupler, right?
So what do you think: Is it advisable to use a 2N2222?