I was just thinking about using the reset pin indeed... In my case I could supply the switch with 5v on one side and 3.3v on the other side, wiring the middle pin to the 'reset' pin. This way I have one pin free for the MOSFET and still one for measuring the voltage of the LiPo.
Raspberry Pi ATTiny85 I2C Interfacing
- bouke
- Posts: 18
- Joined: Sun Jun 18, 2017 8:28 am
- Location: Enschede, The Netherlands
- Has thanked: 1 time
- Been thanked: 7 times
- Contact:
Re: Raspberry Pi ATTiny85 I2C Interfacing
Currently figuring out how to build my first Game Boy Zero. 

- moosepr
- Posts: 524
- Joined: Wed Jan 25, 2017 6:18 am
- Has thanked: 69 times
- Been thanked: 241 times
- Contact:
Re: Raspberry Pi ATTiny85 I2C Interfacing
well i had thought of having the standard 1 pin to trigger the shutdown and 1 pin to detect a live pi, but then i thought i may as well use those 2 pins and use i2c for extra geek cred (and it means the pi can know the battery voltage)
its a shame the pi cant report on its 5v levels. That would allow for low battery safe shutdowns with no MCU on my unboosted projects
its a shame the pi cant report on its 5v levels. That would allow for low battery safe shutdowns with no MCU on my unboosted projects
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
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
- bouke
- Posts: 18
- Joined: Sun Jun 18, 2017 8:28 am
- Location: Enschede, The Netherlands
- Has thanked: 1 time
- Been thanked: 7 times
- Contact:
Re: Raspberry Pi ATTiny85 I2C Interfacing
Forked the repository from Camble which is a great start for the I2C communication between the Pi and ATTiny85. https://github.com/regnerus/Safe-Shutdo ... controller
Changed the communication library from TinyWire to Wire since I am testing/developing with an Arduino Uno instead of an ATTiny85.
Also updated my first post with what I've learnt so far... currently looking at the ATTiny167 as an alternative with more pins.
Changed the communication library from TinyWire to Wire since I am testing/developing with an Arduino Uno instead of an ATTiny85.
Also updated my first post with what I've learnt so far... currently looking at the ATTiny167 as an alternative with more pins.
Currently figuring out how to build my first Game Boy Zero. 

-
- Posts: 2
- Joined: Sat Aug 12, 2017 9:52 am
Re: Raspberry Pi ATTiny85 I2C Interfacing
Hi all! I've been working on (well, more like envisioning...) almost the exact same thing! At this point I'm just running some simple tests to see if it's possible using the usitwislave library (what TinyWireS uses) - trying to avoid the Arduino and TinyWireS libraries in order to save space.
For some reason, I haven't been able to get the tiny to be recognized by the pi. I guess there's a bug with the pi's hardware but I suspect that's not the issue.
Has anyone had any luck using the TinyWireS library to communicate between a pi and AtTiny? If so, what clock speed are you using? I'm using a tiny84 (14 pin) by the way.
For some reason, I haven't been able to get the tiny to be recognized by the pi. I guess there's a bug with the pi's hardware but I suspect that's not the issue.
Has anyone had any luck using the TinyWireS library to communicate between a pi and AtTiny? If so, what clock speed are you using? I'm using a tiny84 (14 pin) by the way.
- bouke
- Posts: 18
- Joined: Sun Jun 18, 2017 8:28 am
- Location: Enschede, The Netherlands
- Has thanked: 1 time
- Been thanked: 7 times
- Contact:
Re: Raspberry Pi ATTiny85 I2C Interfacing
Interesting, I hadn't really looked into the TinyWire library itself and didn't know there is actually another library behind it.LeopoldVonBuschLight wrote: ↑Sat Aug 12, 2017 10:13 amHi all! I've been working on (well, more like envisioning...) almost the exact same thing! At this point I'm just running some simple tests to see if it's possible using the usitwislave library (what TinyWireS uses) - trying to avoid the Arduino and TinyWireS libraries in order to save space.
Untill now I used the Arduino Uno for the uploading convenience etc...LeopoldVonBuschLight wrote: ↑Sat Aug 12, 2017 10:13 amFor some reason, I haven't been able to get the tiny to be recognized by the pi. I guess there's a bug with the pi's hardware but I suspect that's not the issue.
Currently figuring out how to build my first Game Boy Zero. 

- moosepr
- Posts: 524
- Joined: Wed Jan 25, 2017 6:18 am
- Has thanked: 69 times
- Been thanked: 241 times
- Contact:
Re: Raspberry Pi ATTiny85 I2C Interfacing
I have been making a tiny board that might be of use. It's got an attiny85, neopixel, FET, and a switch.
It's untested at the moment, just waiting for the boards to land from oshpark (0.8mm boards take forever)
https://oshpark.com/projects/de5u0PZw
I have broken the i2c pins and the switch pins to the edges. You don't have to use i2c of course, they are MCU pins after all
It's untested at the moment, just waiting for the boards to land from oshpark (0.8mm boards take forever)
https://oshpark.com/projects/de5u0PZw
I have broken the i2c pins and the switch pins to the edges. You don't have to use i2c of course, they are MCU pins after all
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
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
-
- Posts: 2
- Joined: Sat Aug 12, 2017 9:52 am
Re: Raspberry Pi ATTiny85 I2C Interfacing
Sorry, I meant that I was unable to communicate between the pi and tiny via i2c. I think I'll try burning the arduino bootloader to the tiny and seeing if the TinyWireS library works any better for me.Untill now I used the Arduino Uno for the uploading convenience etc...
- Camble
- Posts: 885
- Joined: Thu May 05, 2016 2:31 am
- Location: Scotland
- Has thanked: 269 times
- Been thanked: 488 times
Re: Raspberry Pi ATTiny85 I2C Interfacing
I had a crack at this a while ago. I had planned to incorporate analog battery reads into my boards, but never completed it. The battery level is periodically monitored, but I never fully implemented the I2C communication. I'm looking to revisit it, which is how I ended up here.
My code might help:
https://github.com/Camble/RPi-I2C - the battery monitor for ATTiny85.
https://github.com/Camble/Safe-Shutdown-Microcontroller - this is something i was working on for the ATTiny167. It obviously won't fit on the ATTiny85, but I think the I²C code is a little further along so might be worth looking at.
Both sketches function as a keyboard, so if you connect the board by USB, it will output the battery voltages as keypresses.
My code might help:
https://github.com/Camble/RPi-I2C - the battery monitor for ATTiny85.
https://github.com/Camble/Safe-Shutdown-Microcontroller - this is something i was working on for the ATTiny167. It obviously won't fit on the ATTiny85, but I think the I²C code is a little further along so might be worth looking at.
Both sketches function as a keyboard, so if you connect the board by USB, it will output the battery voltages as keypresses.
Who is online
Users browsing this forum: No registered users and 1 guest