Page 2 of 2

Re: Battery level monitoring with an ATTiny85

Posted: Mon Dec 05, 2016 5:54 am
by abrugsch
[mention]Camble[/mention] are you programming your digistumps with arduino on Win10? I've found since upgrading that I can't program them anymore...
I'm probably just being a moron though...

Re: Battery level monitoring with an ATTiny85

Posted: Mon Dec 05, 2016 6:03 am
by Camble
@abrugsch Win8.1

Re: Battery level monitoring with an ATTiny85

Posted: Mon Dec 05, 2016 6:16 am
by abrugsch
Urgh.
maybe I'll just revert my lappy to win 7 then ;)

Re: Battery level monitoring with an ATTiny85

Posted: Wed Jan 25, 2017 6:34 am
by moosepr
Hi [mention]camble[/mention]

did you make much progress on this? I was thinking of doing something similar, switch/FET/NeoPixel and use it to switch the pi too.

i initially thought the attiny could grab the voltage, and time how long ago the last i2c read was, using that 'last read' to decide if the pi is there or not.

Re: Battery level monitoring with an ATTiny85

Posted: Wed Jan 25, 2017 7:25 am
by Camble
@moosepr I'm working on it on and off. I have an ATTiny85 project for battery monitoring, and an ATTiny167 project for power management and more.

I think you'll need to run the AVR as slave, so if you want to do any switching or graceful shutdown, you'll need additional GPIO pins over and above the I²C pins. I was originally requesting a struct of information from the AVR, which would contain an instruction to shutdown, but there would be a delay between sliding the switching and the actual shutdown. So I opted to keep the dedicated shutdown GPIO.

Re: Battery level monitoring with an ATTiny85

Posted: Wed Jan 25, 2017 8:17 am
by moosepr
well i had thought the tiny could have to values to read write to (tiny in slave mode), voltage and status.

tiny can read voltage, show the right colour on the neopixel, keep the pi on

pi can read the voltage/status once a second maybe. if the status determines it, the pi will shut down, if the pi is shutting down internally it can set the status on the tiny so that knows the situation. worst case, there will be a second delay between triggering the shutdown on the tiny, and the pi starting to shutdown, that way, only the 2 pins will be needed.

this is all theory at the moment :D

Re: Battery level monitoring with an ATTiny85

Posted: Wed Jan 25, 2017 8:30 am
by Camble
@moosepr This may help:

https://github.com/Camble/Safe-Shutdown-Microcontroller

It's not in a working state right now though. The C stuff is almost done, but I've not got finished the I²C communication yet.

Re: Battery level monitoring with an ATTiny85

Posted: Wed Jan 25, 2017 8:48 am
by moosepr
@Camble

thanks for that, i will have a look. Im actually running the tiny (and the pi) direct from the battery, so i technically dont need the analog pin to read the voltage, i found some code a while back that lets the tiny measure its own internal voltage

Re: Battery level monitoring with an ATTiny85

Posted: Fri Jul 21, 2017 10:18 am
by barok
Camble wrote:
Wed Jan 25, 2017 8:30 am
@moosepr This may help:

https://github.com/Camble/Safe-Shutdown-Microcontroller

It's not in a working state right now though. The C stuff is almost done, but I've not got finished the I²C communication yet.
Hi Camble, this battery level monitoring, it's working? Can you explain the schematic? I wanna use only the IC. Not the usb board with IC.
Can you show how it?

Thanks! (I'm waiting the shipping of my Safe Shutdown :P )