# Implement automatic voltage switching into the SATL

Posted on Feb 7, 2014

CRTGND is not the same as GND, CRTGND connects to the mostfet drain/schottky diode. There is a downside to this circuit which is that there is a voltage drop when running from the USB side due to the diode. The USB voltage can vary between 4. 75V to 5. 25V and the good news is that our ATtiny85 can run fine at 16. 5MHz whilst at 4. 0V. If the USB voltage was really 4. 75V,

we would just make it to 4. 05V but we want the best possible voltage even if it was 4. 75V. Instead of using just a standard diode we`ll use a schottky diode which can provide a lower voltage drop of 0. 3V instead of the 0. 7V from standard diodes. We could just wire it all up and run it but we have a problem. If we insert the battery, by default we are running at 16MHz (using the PLL clock) which is outside of the safe frequency range of 3V when powered by the battery. Before we go any further please take a look at my video called Change the ATtiny85 clock speed on the fly which will give you an idea of how we can change the clock speed using the clock prescaler. What we`ll need to do is somehow have the ATtiny85 reduce it`s clock speed when powered on. When the ATtiny85 comes out of the factory it`s clock speed is 1MHz even though it uses the internal 8MHz oscillator. It does this by setting a fuse bit (CKDIV8) to divide the clock by 8 which gives us the 1MHz. So let`s just set this CKDIV8 fuse bit on again (we turned it off when we were playing around with V-USB and set our clock to PLL) which will make it run at 2MHz (16MHz / 8 ) when power is applied to it. After it`s powered on, we could then reduce the clock even more to give our desired clock of 1MHz and just ramp back up to 16MHz when we detect that the USB is connected. void setup(void) { // Change 2MHz to 1 MHz by changing clock prescaler to 16 CLKPR =...

Leave Comment

characters left:

• ## New Circuits

.

Popular Circuits

The ATL-3 Loop Antenna
Triangle- And Square-Wave Generator Circuit
digital modified sine wave inverter
Classroom Microphone System Circuit
Light Fence Security Alarm Circuit Schematic
Simply by remote control law circuit diagram
Valve Tube Audio/Modulation Amplifiers 15W and 35W

Top