Battery level monitoring with an ATTiny85

Various user-contributed guides for software-related things
User avatar
abrugsch
Posts: 971
Joined: Tue Aug 02, 2016 10:00 am
Has thanked: 356 times
Been thanked: 430 times
Contact:

Re: Battery level monitoring with an ATTiny85

Post by abrugsch » Mon Dec 05, 2016 5:54 am

[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...

User avatar
Camble
Posts: 881
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 487 times

Re: Battery level monitoring with an ATTiny85

Post by Camble » Mon Dec 05, 2016 6:03 am

@abrugsch Win8.1


User avatar
moosepr
Posts: 523
Joined: Wed Jan 25, 2017 6:18 am
Has thanked: 69 times
Been thanked: 241 times
Contact:

Re: Battery level monitoring with an ATTiny85

Post by moosepr » Wed Jan 25, 2017 6:34 am

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.
Get a small cheep LCD in your project https://www.sudomod.com/forum/viewtopic.php?f=22&t=2312
Wrap it all round a battery https://www.sudomod.com/forum/viewtopic.php?f=13&t=2292
Or use a custom PCB to make it really small https://www.sudomod.com/forum/viewtopic.php?f=13&t=2512
or make it really really really really tiny!! https://www.sudomod.com/forum/viewtopic.php?f=13&t=2919

User avatar
Camble
Posts: 881
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 487 times

Re: Battery level monitoring with an ATTiny85

Post by Camble » Wed Jan 25, 2017 7:25 am

@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.

User avatar
moosepr
Posts: 523
Joined: Wed Jan 25, 2017 6:18 am
Has thanked: 69 times
Been thanked: 241 times
Contact:

Re: Battery level monitoring with an ATTiny85

Post by moosepr » Wed Jan 25, 2017 8:17 am

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
Get a small cheep LCD in your project https://www.sudomod.com/forum/viewtopic.php?f=22&t=2312
Wrap it all round a battery https://www.sudomod.com/forum/viewtopic.php?f=13&t=2292
Or use a custom PCB to make it really small https://www.sudomod.com/forum/viewtopic.php?f=13&t=2512
or make it really really really really tiny!! https://www.sudomod.com/forum/viewtopic.php?f=13&t=2919

User avatar
Camble
Posts: 881
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 487 times

Re: Battery level monitoring with an ATTiny85

Post by Camble » 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.

User avatar
moosepr
Posts: 523
Joined: Wed Jan 25, 2017 6:18 am
Has thanked: 69 times
Been thanked: 241 times
Contact:

Re: Battery level monitoring with an ATTiny85

Post by moosepr » Wed Jan 25, 2017 8:48 am

@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
Get a small cheep LCD in your project https://www.sudomod.com/forum/viewtopic.php?f=22&t=2312
Wrap it all round a battery https://www.sudomod.com/forum/viewtopic.php?f=13&t=2292
Or use a custom PCB to make it really small https://www.sudomod.com/forum/viewtopic.php?f=13&t=2512
or make it really really really really tiny!! https://www.sudomod.com/forum/viewtopic.php?f=13&t=2919

barok
Posts: 2
Joined: Wed Jul 12, 2017 6:50 am

Re: Battery level monitoring with an ATTiny85

Post by barok » Fri Jul 21, 2017 10:18 am

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 )

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest