[Server-devel] smooth shutdown for 12V-DC powered XS

James Cameron quozl at laptop.org
Thu May 10 01:17:18 EDT 2012

On Wed, May 09, 2012 at 11:52:12PM +0200, K??vin Raymond wrote:
> Keep it simple is probably the best???
> I've got an Arduino Diecimila, which is quite big for our purpose, I
> also have a PIC32 Pinguino board, which is really great but too much
> powerful???
> Xavier, we could make a really tiny board, or buy one, with a small
> microcontroller (Microchip is best for USB but Atmel will do).
> I've done what you asked for using this arduino board and a USB
> connection, but I still have to calibrate the analog input in order to
> have an acurate voltage value.

It might not be necessary to calibrate, if the raw value is sent to
the computer, the computer software can be calibrated instead.

It is still be necessary to ensure the values are within the range of
the analog to digital converter.  If you only see 1023, the voltage is
out of range.

> I don't really know Arduino, neither how to put the board asleep, it
> could consume less???


See also

However, you face an important problem, which is how to wake from
sleep.  You might configure it to wake on serial input, and have the
computer software wake the arduino to take a reading.  I did that a
few weeks ago with a fridge power monitor.

You might still have power to the USB chip, U4.

> At the analog input I just have a voltage divider (passive is best,
> but more current is drawn???).

The current drawn by a voltage divider is related by ohms law to the
total resistance of the divider, from top to bottom.

Increasing the resistance has a bad side effect of increasing the
noise on the reading.

Adding a capacitor from the centre of the divider to ground will
decrease the noise.  But too large a capacitor will slow the response
to rapid changes.

I suggest a 100k potentiometer with a 1uF capacitor.

> On this bart, I still have to learn how to use Arduino
> interrupt/watchdog with an internal timer, in order to use less power???
> I only know Microchip???

I know Microchip too, so I know how you feel.  The data I see suggests
it is certainly possible to reduce the power usage of your ATMEGA8.

> The host computer software is just a C program reading the serial port
> and sending a system command (poweroff) at a certain threshold.

C?  I guess that has the lowest power cost.  I have used Python, or
Bash.  Fast to develop.

> I still have to use dbus or libusb or anything else (udev is too
> simple, not smart!), to start the deamon when the card is plugged.

That would be nice, but is not critical.  For instance, on my system I
can find the device in /dev/serial/by-id or /by-path, and use Bash to
check for device existence before continuing.

> Will also probably need to have take an average on the input values.

Yes.  Unfortunate to have shutdown just because of momentary noise.

> I shall finish that for our XS setup workshop???
> If you've any comments, or board preferences???
> -- 
> K??vin Raymond
> (shaiton)
> GPG-Key: A5BCB3A2

James Cameron

More information about the Server-devel mailing list