0

Petanque Pro Complete!

Posted by Chris on Monday, October 19, 2009
That's it.
Finished.
Finito.
Done. Complete. Put to bed.
ScoreSure Petanque Pro is coded up, utterly and completely, with no further coding needed. It's done. And works. And all the nasty little bugs have been ironed out, and all the failsafes are in place (such as saving info to eeprom as you go along, so nothing gets lost in the event of a power failure).

In fact, adding in the power-failure auto-save-as-you-go code has allowed us to implement a new idea - it's one that's bugged us from the start: how to tell whether the device is running off the battery, or from a USB supply. In our early schematics, we used a diode from the USB port, onto the power rail, with a connection "behind" the diode to a pin on the microcontroller. If a signal is received on this pin, power is being supplied by the USB port. If there's no signal, power must be coming from the battery.



The only problem with using a diode is the voltage drop across it is about 0.7V, leaving just 4.3V from the USB port into the device. This is right on the limit of working voltage for the LCD screen - our original idea was to power the LCD from the PIC micro, and if we were in USB-powered mode, the LCD simply does not switch on (the PIC and EEPROM are low-voltage versions: 18LF2455 and 24LC256 - the "L" in each means "lower voltage" - and can operate at voltages as low as 2.5V).
This is a bit of a kludge, but a workable solution.
The only issue with this is that the "check to see if you need to start in USB mode" occurs only at the beginning: once the device has been started in USB/non-USB mode, no further checks are made. So it's quite possible that the device could be running off the battery, then is plugged into the USB port. Although the device is now powered from the USB port, it still thinks it's being powered by the battery, so does not try to communicate with the host PC.

Now, by allowing the power to be dropped at any time, we've allowed ourselves the luxury of a slide-switch to change modes. This is perfect as not only does it provide a definite switch over between battery and USB mode, it also provides physical isolation between the two power circuits. The switch means that ONLY battery OR usb power can be drawn, and never the two together.

The slide-switch can also be used as an on-off switch for when the device is used "out in the field". Slide to "battery powered" and the device not only boots up using the battery as a power source, but it restores itself to the last state it was in: no more having to go through the start menu and choose player etc, simply switch on and carry on from where you left off.
Likewise, once you're done, slide the switch over to "usb-mode" and the battery is completely isolated from the circuit, meaning no unnecessary power drain.

Genius!!

0 Comments

Post a Comment

whos.amung.us

Copyright © 2009 .Nerd Club All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive Supported by Blogger Templates.