Black Lives Matter - Action and Equality. ... Adafruit is part of the Stop Hate for Profit campaign. Adafruit is open and shipping.
0

PyGamer-Thermal_Camera-amg8833
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

PyGamer-Thermal_Camera-amg8833

by Rosebud on Thu Mar 26, 2020 8:43 am

The PyGamer_Thermal_Camera code fails at line 13, in <module> Import Error: no module named "adafruit_pybadger, PyBadger'. It fails using CircuitPython 5.0.0, or CircuitPython 4.1.2 and respective libraries. It appears adafruit_pybadger is looking for pybadger, pygamer instead of PyGamer and PyBadger, but if changed an error occurs in line 19 looking for PyGamer.

How do I correct the code? Help would be appreciated.

Rosebud
 
Posts: 16
Joined: Tue Aug 14, 2012 8:43 pm

Re: PyGamer-Thermal_Camera-amg8833

by dastels on Thu Mar 26, 2020 9:03 am

Are you using the latest copy of the respective libraries?
Also, I advise you stick with 5.0.0.

The init for the library does some "magic" to import the appropriate submodule for the hardware it's running on.

Dave

dastels
 
Posts: 2802
Joined: Tue Oct 20, 2015 3:22 pm

Re: PyGamer-Thermal_Camera-amg8833

by Rosebud on Thu Mar 26, 2020 9:49 am

adafruit-circuitpython-bundle-5.x-mpy-20200324 with circuitpython 5.0.0; it there a newer one?
adafruit-pybadger was dated 3/17/2020---AdafruitPyBadger Library Documentation Release 1.0

Rosebud
 
Posts: 16
Joined: Tue Aug 14, 2012 8:43 pm

Re: PyGamer-Thermal_Camera-amg8833

by dastels on Thu Mar 26, 2020 10:27 am

You have the latest.

What your CIRCUITPY/lib directory look like when fully expanded?

Dave

dastels
 
Posts: 2802
Joined: Tue Oct 20, 2015 3:22 pm

Re: PyGamer-Thermal_Camera-amg8833

by Rosebud on Thu Mar 26, 2020 4:48 pm

Is this what you want?
lib folder has 6 folders and 5 mpy files.
folders
adafruit_bitmaps_font
_init_.py
bdf.mpy
bitmap_font.mpy
glyph_cache.mpy
pcf.mpy
ttf.mpy
adafruit_bus_device
_init_.py
i2c_device.mpy
spi_device.mpy
adafruit_display_shapes
circle.mpy
line.mpy
polygon.mpy
rect.mpy
roundrect.mpy
triangle.mpy
adafruit_display_text
label.mpy
adafruit_pybadger
_init_.mpy
clue.mpy
pybadge.mpy
pybadger_base.mpy
pygamer.mpy
adafruit_register
_init_.py
i2c_bcd_alarm.mpy
i2c_bcd_datetime.mpy
i2c_bit.mpy
i2c_bits.mpy
i2c_struct.mpy
i2c_struct_arry.mpy
mpy files
amg88xx.mpy
lis3dh.mpy
miniqr.mpy
neopixel.mpy
simpleio.mpy

Rosebud
 
Posts: 16
Joined: Tue Aug 14, 2012 8:43 pm

Re: PyGamer-Thermal_Camera-amg8833

by dastels on Thu Mar 26, 2020 5:32 pm

Yes, that's it. Everything looks as it should.

Can you past in the output from the REPL.

Dave

dastels
 
Posts: 2802
Joined: Tue Oct 20, 2015 3:22 pm

Re: PyGamer-Thermal_Camera-amg8833

by Rosebud on Thu Mar 26, 2020 6:13 pm

code.py output:
Traceback (most recent call last):
File "code.py", line 13, in <module>
ImportError: no module named 'adafruit_pybadger.PyBadger'

Rosebud
 
Posts: 16
Joined: Tue Aug 14, 2012 8:43 pm

Re: PyGamer-Thermal_Camera-amg8833

by dastels on Thu Mar 26, 2020 7:02 pm

It should be pybadger, not PyBadger

dastels
 
Posts: 2802
Joined: Tue Oct 20, 2015 3:22 pm

Re: PyGamer-Thermal_Camera-amg8833

by Rosebud on Thu Mar 26, 2020 7:52 pm

If you change line 13 to:
from adafruit_pybadger import pybadger

you will fail on line 19:
panel = PyBadger(pixels_brightness=0.1) # Set NeoPixel brightness

If you change line 19 to:
panel = pybadger(pixels_brightness=0.1) # Set NeoPixel brightness

code.py output:
Traceback (most recent call last):
File "code.py", line 19, in <module>
TypeError: 'PyGamer' object is not callable

I don't know where PyGamer came from, but I bet pybadger would be happy if it were pygamer, maybe.

Rosebud
 
Posts: 16
Joined: Tue Aug 14, 2012 8:43 pm

Re: PyGamer-Thermal_Camera-amg8833

by dastels on Thu Mar 26, 2020 9:33 pm

After looking through the thermal camera guide as well as the PyBadger code an examples, I think the library has evolved (and I do recall a lot of update messages regarding that library) while the guide code hasn't. Have a look through the examples (https://github.com/adafruit/Adafruit_CircuitPython_PyBadger/tree/1cf2d83c6e0471570535840fdf94431456926752/examples) and see what needfs to be changed. The actual library code is at https://github.com/adafruit/Adafruit_CircuitPython_PyBadger/tree/master/adafruit_pybadger. You'll want to look primarily at pybadger_base.py and pygamer.py

Dave

dastels
 
Posts: 2802
Joined: Tue Oct 20, 2015 3:22 pm

Re: PyGamer-Thermal_Camera-amg8833

by Rosebud on Fri Mar 27, 2020 9:32 am

I replaced the latest adafruit_badger file with a version 1.1.1 for circuitpython 5x and it worked as the original PyGamer_Thermal_Camera code.

Dave thank you, and stay safe.

Rosebud
 
Posts: 16
Joined: Tue Aug 14, 2012 8:43 pm

Re: PyGamer-Thermal_Camera-amg8833

by dastels on Fri Mar 27, 2020 9:58 am

I love a good workaround. Have fun, and stay safe yourself.

Dave

dastels
 
Posts: 2802
Joined: Tue Oct 20, 2015 3:22 pm

Re: PyGamer-Thermal_Camera-amg8833

by joseuzziel on Mon Jun 01, 2020 11:57 am

Hello,
How can I get an average object temperature from AMG8833 by using a Python script?
I tried by reading "temperature" property, however, it changes very slowly, it seems to be ambient temperature.

i2c = io.I2C(board.SCL, board.SDA)
amg = adafruit_amg88xx.AMG88XX(i2c)
temp_object = amg.temperature
print(temp_object)

Thanks a lot for your gentle attention.
Best regards,

joseuzziel
 
Posts: 1
Joined: Mon Jun 01, 2020 11:19 am

Re: PyGamer-Thermal_Camera-amg8833

by dastels on Mon Jun 01, 2020 3:19 pm

The temperature of the object it's pointing at? Ready the pixels with amg.pixels, iterate over the resulting 2 dimensional array adding the values, then divide by 64.

Dave

dastels
 
Posts: 2802
Joined: Tue Oct 20, 2015 3:22 pm

Re: PyGamer-Thermal_Camera-amg8833

by qwertypoiuyt on Wed Jun 03, 2020 9:52 pm

I am trying to get the thermal camera to work on the pygamer. I read through the responses above from Rosebud, and I have the same errors he did, with line 13. I don't understand his workaround that apparently fixed it. I have the newest libraries and uf2 file downloaded. I tried a few older ones as well, but got the same errors.
qwertypoiuyt
 
Posts: 1
Joined: Sun May 12, 2013 6:15 am

Please be positive and constructive with your questions and comments.