Hi, I'm building a DIY UPS for a Raspberry Pi using a 12V SLA battery, charger, and an off the shelf 5V regulator. To monitor the battery level I'd like to use an Arduino or similar type device. Since the Arduino can have a serial over USB connection with the Pi I'd like to implement a protocol that can be used with NUT. Does anyone know if something like this has already been done? The only thing I could find was this [1], but it doesn't look like there is a NUT driver. Maybe I'm not searching with the right terms? If I were implement a UPS protocol what would be the easiest one to implement that is already supported by NUT? [1] https://gist.github.com/maxupunk/f38ae7d2c633533e12e99e49995e7893 Glenn
On Aug 19, 2018, at 3:31 PM, Glenn Ramsey <gr at componic.co.nz> wrote:> > Hi, > > I'm building a DIY UPS for a Raspberry Pi using a 12V SLA battery, charger, and > an off the shelf 5V regulator. To monitor the battery level I'd like to use an > Arduino or similar type device. Since the Arduino can have a serial over USB > connection with the Pi I'd like to implement a protocol that can be used with NUT. > > Does anyone know if something like this has already been done? The only thing I > could find was this [1], but it doesn't look like there is a NUT driver. Maybe > I'm not searching with the right terms?I'm at a loss for the right search terms, and I know we had someone considering building a USB/HID version of what you are talking about. If there was indeed another discussion, it would probably be on the nut-upsdev lists: https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev A related UPS project (but I think they ruled out Arduino-class processors early): https://gitlab.com/esr/upside/wikis/external-interface> > If I were implement a UPS protocol what would be the easiest one to implement > that is already supported by NUT?The Megatec/Q* protocols are fairly ubiquitous, so that might be where I would start. You mentioned serial-over-USB - does the Arduino show up as a /dev/ttyUSB* node or similar on the Pi? The following assumes that it does. blazer_ser has some test strings: https://github.com/networkupstools/nut/blob/v2.7.4/drivers/blazer_ser.c#L73 but development has been moved to nutdrv_qx, which is the preferred driver to test against (though it is a bit more comprehensive, and perhaps less clear at first glance). Protocol documentation: https://networkupstools.org/protocols/megatec.html
Thanks Charles, On 20/08/18 13:55, Charles Lepple wrote:> On Aug 19, 2018, at 3:31 PM, Glenn Ramsey <gr at componic.co.nz> wrote: >> >> Hi, >> >> I'm building a DIY UPS for a Raspberry Pi using a 12V SLA battery, charger, >> and an off the shelf 5V regulator. To monitor the battery level I'd like to >> use an Arduino or similar type device. Since the Arduino can have a serial >> over USB connection with the Pi I'd like to implement a protocol that can >> be used with NUT. >> >> Does anyone know if something like this has already been done? The only >> thing I could find was this [1], but it doesn't look like there is a NUT >> driver. Maybe I'm not searching with the right terms? > > I'm at a loss for the right search terms, and I know we had someone > considering building a USB/HID version of what you are talking about. If > there was indeed another discussion, it would probably be on the nut-upsdev > lists: > > https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdevI found a post there from 2010: https://alioth-lists.debian.net/pipermail/nut-upsdev/2010-April/004740.html that describes what I want.> A related UPS project (but I think they ruled out Arduino-class processors > early): https://gitlab.com/esr/upside/wikis/external-interface > >> >> If I were implement a UPS protocol what would be the easiest one to >> implement that is already supported by NUT? > > The Megatec/Q* protocols are fairly ubiquitous, so that might be where I > would start. > > You mentioned serial-over-USB - does the Arduino show up as a /dev/ttyUSB* > node or similar on the Pi? The following assumes that it does. > > blazer_ser has some test strings: > > https://github.com/networkupstools/nut/blob/v2.7.4/drivers/blazer_ser.c#L73 > > but development has been moved to nutdrv_qx, which is the preferred driver to > test against (though it is a bit more comprehensive, and perhaps less clear > at first glance). > > Protocol documentation: https://networkupstools.org/protocols/megatec.htmlThanks very much for that. That lead me to find this: https://github.com/xm381/Raspberry-Pi-UPS which appears to be exactly what I was looking for. Glenn