coreymanshack
New Member
First of all I would like to note that I am very new to building circuits, the raspberry pi, and attiny85. I have been doing a lot of research on what I'm trying to do but I have a few questions. I want to use the attiny85 to measure voltage of a 1.5V battery as in this schematic and send it to the GPIO on the raspberry pi and read the digital result via python and log it; https://123d.circuits.io/circuits/111623 ... ry-pi-gpio
I will be doing the following with the circuit -
Analog in on pin 2 of the attiny (positive battery terminal, negative side of battery grounded to GPIO) - digital out on pin 7 of the attiny. Then I want to send digital out from attiny to GPIO on pin 3 to read with a python program on raspbian and log it.
I know I need avrdude to program the attiny and a simple DAPA circuit ( I will be using the serial port and passing avrdude the serial option ). What I don't know - is what code to write for the attiny to accept analog input on pin 2 and send the digital equiv out on pin 7. I then don't know how to access GPIO pin 3 with python and read the result to log it. Can anyone help me and/or point me to some documentation on how to do these two things?
Update:
I found this link for interfacing GPIO with python https://sourceforge.net/p/raspberry-gpio ... wiki/Home/ and on the digital section it says the following -
Input
To read the value of a GPIO pin:
GPIO.input(channel)
(where channel is the channel number based on the numbering system you have specified (BOARD or BCM)). This will return either 0 / GPIO.LOW / False or 1 / GPIO.HIGH / True.
So what I don't understand now is how do I measure voltage programmatically from 0 / GPIO.LOW / False or 1 / GPIO.HIGH / True
I will be doing the following with the circuit -
Analog in on pin 2 of the attiny (positive battery terminal, negative side of battery grounded to GPIO) - digital out on pin 7 of the attiny. Then I want to send digital out from attiny to GPIO on pin 3 to read with a python program on raspbian and log it.
I know I need avrdude to program the attiny and a simple DAPA circuit ( I will be using the serial port and passing avrdude the serial option ). What I don't know - is what code to write for the attiny to accept analog input on pin 2 and send the digital equiv out on pin 7. I then don't know how to access GPIO pin 3 with python and read the result to log it. Can anyone help me and/or point me to some documentation on how to do these two things?
Update:
I found this link for interfacing GPIO with python https://sourceforge.net/p/raspberry-gpio ... wiki/Home/ and on the digital section it says the following -
Input
To read the value of a GPIO pin:
GPIO.input(channel)
(where channel is the channel number based on the numbering system you have specified (BOARD or BCM)). This will return either 0 / GPIO.LOW / False or 1 / GPIO.HIGH / True.
So what I don't understand now is how do I measure voltage programmatically from 0 / GPIO.LOW / False or 1 / GPIO.HIGH / True