Hello,
If you are using the BBB and not the BBAI, please use the correct image. AM5729 is the chip on the BBAI.
Also, if you are using Python3, print statements are not the same in Python3.
Seth
P.S. Python3 script:
import Adafruit_BBIO.ADC as ADC
from time import sleep
ADC.setup()
analogPin33 = "P9_33"
while True:
centertap = ADC.read(analogPin33)
voltage = centertap * 1.8
print("Voltage...: ", voltage)
That is for starters. Python3 for some reason, from what I have seen, keeps changing their formatted print functions and options/arguments within the print function.
Anyway, long story short…
Here is the correct image: https://debian.beagleboard.org/images/bone-debian-10.3-iot-armhf-2020-04-06-4gb.img.xz
And I know this is boring but before running some simple source in Python3 for analog voltage or temperature or whatever, please sudo apt update && sudo apt upgrade
your machine. OH! And…
The board will do a nightrider pattern
, show all LEDs lit, and then power down. Once the board, w/ only the eMMC/Flasher version of the image, shuts down, you can then unplug and take the SD Card out. That should give you a fresh image on your eMMC storage. Um, if you need any other things answered, I will do my best to describe things to you but if it gets too complicated, I might have to allow for you to have some other sort answer. There are a ton of smarties around the globe that know about Linux, BBB.io, and the computations available from the SiP and SoC (am335x) and other variants like the am5729 on the BBAI.
It will make fun easier. If you just want the flasher image, the image w/out SD Card capabilities, use this image and it will burn the contents of the SD Card onto your eMMC on the BBB: https://debian.beagleboard.org/images/bone-eMMC-flasher-debian-10.3-iot-armhf-2020-04-06-4gb.img.xz .
Seth
P.S. If you are using an analog device, like the TMP36 temperature sensor, RESISTORS! There should be no reason for your analog pin to go above 1.8 volts.
Also…some datasheets will show you what exact specs. you are working w/ currently w/ that specific sensor. Oh!
I just found my book w/ a TMP36 example:
// from "Programming the BeagleBone Black, (Monk 2014)."
// thermometer.js
var b = require('bonescript');
function readTemp() {
b.analogRead("P9_39", displayTemp);
}
function displayTemp(reading) {
var millivolts = reading.value * 1800;
var tempC = (millivolts - 500) / 10;
var tempF = (tempC * 9/5) + 32;
console.log("Temp C = " + tempC + "\tTemp F = " + tempf);
}
setInterval(readTemp, 750);
That, when converted to Python3, should give some sort of calculations that are for Fahrenheit and Celsius every so often printed to the console.