Metro ESP32-S2 and Adafruit io

Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Locked
User avatar
Tom_Henry
 
Posts: 350
Joined: Wed Aug 26, 2020 8:19 pm

Metro ESP32-S2 and Adafruit io

Post by Tom_Henry »

I have set up the following CircuitPython program (see attached) that runs error free on Adafruit’s Metro M4 AirLift Lite with the following output:

Connected!
Connecting to Adafruit IO...

Tom Henry's MS8607 Sensor Data:

Pressure: 14.54 psi
Temperature: 78.45 F
Humidity: 38.36 % rH

————————————————————————

It then connects very nicely to my Adafruit IO account and dashboard.

It uses the Adafruit MS8607 sensor.. The data from this device is sent to one of my Adafruit IO dashboards, and it works great.
In the example I have attached to this message I have commented out the RTC although it does work ok.

Now I just bought Adafruit’s Metro ESP32-S2 Express board. I tried using the same code and ran into some problems with defining the ESP32 info.

I run the code and get the following error related to ESP:

Traceback (most recent call last):
File "code.py", line 49, in <module>
AttributeError: 'module' object has no attribute ‘ESP_CS'

Can you suggest what modifications I need to make to the code so that it will run on Adafruit’s Metro ESP32-S2 Express and work with Adafruit IO?

It seems like I need to modify the code related the ESP32 info.

Thanks,

Tom Henry
Attachments
code.py
(3.5 KiB) Downloaded 6 times

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: Metro ESP32-S2 and Adafruit io

Post by dastels »

The same code won't work since the AirLift Metro uses a SAMD51 MCU with an ESP32 module as a WiFi coprocessor and the ESP32-S2 Metro just has the ESP32-S2 module. Have a look at https://learn.adafruit.com/adafruit-metro-esp32-s2 for examples of using wifi on the Metro ESP32-S2.

Dave

User avatar
Tom_Henry
 
Posts: 350
Joined: Wed Aug 26, 2020 8:19 pm

Re: Metro ESP32-S2 and Adafruit io

Post by Tom_Henry »

Dave,

Thanks for the suggestion.

Ok, I went to https://learn.adafruit.com/adafruit-metro-esp32-s2
and set up the attached file as code.py on my Metro ESP32-S2 board.

Everything worked just fine and the Metro board connected to my WiFi:

This is a test of Adafruit WiFi!
If you can read this, its working :)

Now, can you suggest some Adafruit IO code I can use to connect to Adafruit IO?

I tried using what I did before and of course it didn't work:

io.connect()

and then added: io.publish("humidity", bme680.relative_humidity)

and of course that doesn't work.

Any suggestions would be appreciated,

Thanks,

Tom Henry
Attachments
code.py
(1.7 KiB) Downloaded 2 times

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: Metro ESP32-S2 and Adafruit io

Post by dastels »

Have a try at https://learn.adafruit.com/adafruit-fun ... -date-time. It'll test out connecting to IO.
It's for the FunHouse, but for the purposes of this it's just an ESP32-s2 board.

Also a FunHouse project, and the dash display stuff is FunHouse only, but there should be enough generic Adafruit IO stuff there to get you started: https://learn.adafruit.com/adafruit-io- ... t-funhouse.

Dave

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”