0

help with the PyPortal Pet Planter with Adafruit IO and my T
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

help with the PyPortal Pet Planter with Adafruit IO and my T

by PonyXpress on Fri Jul 01, 2022 3:07 pm

I'm a newbe so be gentle :)

I need some help with my project the "PyPortal Pet Planter with Adafruit IO" and my Titano. I've tried to follow the instructions and I have made some progress, but I have a few issues to sort out.

The Titano boots, I see the roots, temp, and moisture on the display. Good so far....But after a couple of minutes I get some errors about loops.

I also noticed that my Feeds and Dashboard are not receiving any data from my Titano, and the https://io.adafruit.com/ site shows my device is Offline. The Serial output shows that it connects to my wifi and to Adafruit IO. Maybe it's not running long enough to post data.

Here is the output from my Serial connection. It will run for a few minutes, stop with loop errors, and then restart after a few minutes, and just keep doing that for a few times and then just stops at the loop error screen and I have to Reset it.


Adafruit CircuitPython 7.3.1 on 2022-06-22; Adafruit PyPortal Titano with samd51j20
>>>
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
drawing background..
loading fonts...
loading icons...
Connected to WiFi!
Connecting to Adafruit IO...
Connected to Adafruit IO!
Connected!
reading soil sensor...
Temperature: 70F
filling disp..
disp filled..
temp: 69 moisture: 330
reading soil sensor...
Temperature: 70F
filling disp..
disp filled..
temp: 70 moisture: 330
reading soil sensor...
Temperature: 70F
filling disp..
disp filled..
temp: 69 moisture: 330
reading soil sensor...
Temperature: 70F
filling disp..
disp filled..
temp: 69 moisture: 330
reading soil sensor...
Temperature: 69F
filling disp..
disp filled..
temp: 69 moisture: 330
Traceback (most recent call last):
File "code.py", line 271, in <module>
File "adafruit_io/adafruit_io.py", line 239, in loop
File "adafruit_minimqtt/adafruit_minimqtt.py", line 802, in loop
File "adafruit_minimqtt/adafruit_minimqtt.py", line 556, in ping
File "adafruit_esp32spi/adafruit_esp32spi_socket.py", line 86, in send
File "adafruit_esp32spi/adafruit_esp32spi.py", line 766, in socket_write
ConnectionError: Failed to send 2 bytes (sent 0)

Code done running.

Press any key to enter the REPL. Use CTRL-D to reload.


Any ideas?

PonyXpress
 
Posts: 48
Joined: Fri Jul 01, 2022 10:51 am

Re: help with the PyPortal Pet Planter with Adafruit IO and

by mikeysklar on Fri Jul 01, 2022 5:12 pm

It looks like you have most of the project going. So good job so far.

The disconnect issue is probably the place to start.

ConnectionError: Failed to send 2 bytes (sent 0)


How far is your PyPortal Titano from the WiFi?

Are you running the default code with the exception of the secrets.py file specifics?

Have you setup all the AIO feeds / dashboard / charts?

mikeysklar
 
Posts: 8097
Joined: Mon Aug 01, 2016 8:10 pm

Re: help with the PyPortal Pet Planter with Adafruit IO and

by PonyXpress on Fri Jul 01, 2022 6:57 pm

Thank you!

As you can see from my serial output, it says it connects to the network and then it says it is connected to Adafruit. But it doesn't stay running long enough (I guess) to phone home. That assumes the connection error isn't blocking it.

I tried to follow the instructions from this site https://learn.adafruit.com/pyportal-pet-planter-with-adafruit-io/adafruit-io-setup

Wireless signal is not the issue, confirmed with several other wireless devices. I'm currently working at my desk, so my router/AP is only 6 feet away from the Titano.

As best as I recall, this what I loaded:

wippersnapper.pyportal_tinyusb.1.0.0-beta.38.uf2
adafruit-circuitpython-pyportal_titano-en_US-7.3.1.uf2

And then copied the files and folders to Titano:

adafruit-circuitpython-bundle-7.x-mpy-20220510\lib

and then

I had to create the secrets file and it connected when I created my Adafruit account. At that time in the process, it said my device was Online. I setup my Feeds and Dashboard.

And then

pyportal_pet_planter.zip I copied all the files inside the folder \CircuitPython 7.x

There was some other issue where one template for the secrets file was to call everything "io_username, io_password" and so on. the website instructions said to use the one there, and it called everything "aio_username, etc. etc." The aio one is working so that is the format of my secrets file. My wifi ssid, password, Adafruit username and that big ass long KEY is in there.

I was getting an error on boot up saying it didn't find the secrets.py file. So I made a copy of the secrets.json file and named it secrets.py and it then went past that point in the boot up. I had to make one other change in the secrets file. Line 193 in the code.py file calls for "aio username" from the secrets file. My secrets file was calling that just "user", so I changed it to "username" and that error went away.

I attached a screenshot of my Titano drive.

Titano_storage.JPG
Titano drive
Titano_storage.JPG (29.08 KiB) Viewed 296 times


I attached a picture of the display. It will show that screen until the code stops running, about 2 minutes. It then shows the same content as the output from the Serial connection, loop errors
SmartPlanter.JPG
display
SmartPlanter.JPG (42.89 KiB) Viewed 296 times


In my original post here, I said that it restarts after the code stops running. That is not correct. What is displayed on the Serial output is the code running, and repeating a set of instructions. I think that is a good thing, as it's reading the temp sensors, updating the display with current information. It will cycle like that a few times before the code stops running. I have to reset it to get it going again.

One other piece of information. After creating an Adafruit account and getting connected, the instructions offered up some Test runs with Test Feeds and a bunch of other stuff that I skipped. I went to the Code Setup section for the project. I hope I didn't skip anything important. It was the instructions on this page, I skipped the Example Code section,
https://learn.adafruit.com/pyportal-pet-planter-with-adafruit-io/internet-connect

Thanks much for your assistance!

PonyXpress
 
Posts: 48
Joined: Fri Jul 01, 2022 10:51 am

Re: help with the PyPortal Pet Planter with Adafruit IO and

by PonyXpress on Sat Jul 02, 2022 9:32 am

I forgot to ask, how do I troubleshoot the Connection Error - Failed to Send ?

I also would like to know what url is it trying to connect to? I need to make sure my Pi-Hole isn't blocking it.

Thank you

PonyXpress
 
Posts: 48
Joined: Fri Jul 01, 2022 10:51 am

Re: help with the PyPortal Pet Planter with Adafruit IO and

by mikeysklar on Sat Jul 02, 2022 2:15 pm

It would be going back to the Adafruit IO test feeds section and make sure that data is getting pushed successfully to AIO.

The CircuitPython libraries you are using are almost two months old. Can you try using the 20220702 drop? Your 7.3.1 release is good no need to change that just the lib/ libraries.

https://github.com/adafruit/Adafruit_Ci ... 220702.zip

Your code is failing at line 271 which is inside io.loop() which means there is an issue with connecting to Adafruit IO which more than likely is related to a library or authentication issues.

Code: Select all | TOGGLE FULL SIZE
while True:
    # Explicitly pump the message loop
    # to keep the connection active
    try:
        io.loop()
    except (ValueError, RuntimeError) as e:
        print("Failed to get data, retrying...\n", e)
        wifi.reset()
        continue

mikeysklar
 
Posts: 8097
Joined: Mon Aug 01, 2016 8:10 pm

Re: help with the PyPortal Pet Planter with Adafruit IO and

by PonyXpress on Sat Jul 02, 2022 3:21 pm

Well things are now much worse and I have no idea what happened. It was working as I explained in my last post, but crashing about every 2 min. I made zero changes.

I saw your post and decided to try the new lib files. When I plugged it in, it will not boot and just keeps looping the boot. Again, I made zero changes since yesterday.

I decided to run through the instructions again, but nothing helps. No code seems to want to work now.
crashing.JPG
crashing.JPG (84.55 KiB) Viewed 282 times

PonyXpress
 
Posts: 48
Joined: Fri Jul 01, 2022 10:51 am

Re: help with the PyPortal Pet Planter with Adafruit IO and

by PonyXpress on Sat Jul 02, 2022 4:03 pm

That issue turned out to be power. For some reason my gaming tower pc is no longer providing enough power. When I plug into the wall, it started working again. I moved it to my test pc and it works there too. I'll have to sort out the usb power issue later on the gaming pc.

I downloaded the new lib files and copied the lib forder to the Titano, tested again. Same result, crashes after about 2 min with the same errors.

I will go back to the "Connect to the Internet" section and try that again.

PonyXpress
 
Posts: 48
Joined: Fri Jul 01, 2022 10:51 am

Re: help with the PyPortal Pet Planter with Adafruit IO and

by PonyXpress on Sat Jul 02, 2022 5:00 pm

I went back to the part where the instructions have you test connecting to the Internet, ran that code and it worked perfectly. My screen output matched the instruction example of what I should see. It says right on the screen that it connected to my AP, then Adafruit, ping Google, etc. all worked.

What else can I check?

wifitest.JPG
wifitest.JPG (76.52 KiB) Viewed 275 times

PonyXpress
 
Posts: 48
Joined: Fri Jul 01, 2022 10:51 am

Re: help with the PyPortal Pet Planter with Adafruit IO and

by mikeysklar on Tue Jul 05, 2022 1:40 pm

Glad you sorted out the power issue. Best to use a powered USB 2.x hub on your gaming machine as this display + WiFi enabled controller will large amount of current.

Since you know the connectivity is good with your WiFi and the code.py runs correctly for two minutes the part to focus on is logging data to AIO.

Is anything making it to your AIO dashboard?

In your secrets file does it say aio_user or aio_username? I see the code uses aio_user, but the secrets file shows aio_username.

Code: Select all | TOGGLE FULL SIZE
# Initialize a new MQTT Client object
mqtt_client = MQTT.MQTT(broker="io.adafruit.com",
                        username=secrets["aio_user"],
                        password=secrets["aio_key"])

mikeysklar
 
Posts: 8097
Joined: Mon Aug 01, 2016 8:10 pm

Re: help with the PyPortal Pet Planter with Adafruit IO and

by PonyXpress on Tue Jul 05, 2022 5:27 pm

Thanks again for your help. No, nothing reaches my dashboard and it shows nothing for the last Feed, meaning it has never received any Feed data.

I was getting an error early on and it was because the code wanted aio_username and my secretes file was using only aio_user. I updated my secrete file to use aio_username and the error went away. Also, when I tested the "Connect to the Internet" code.py that worked, it was using my same Secrets file. :) Unless, that test doesn't require or use the Secrets file.

Here is what my file looks like, without my actual user name and key, etc.

secrets = {
'ssid' : 'my wifi',
'password' : 'my password',
'timezone' : "America/New_York",
'aio_username' : 'my user name',
'aio_key' : 'aio_mykey',
}

While it seems to work until the communication and loop errors, nothing ever makes it to the dashboard. The communication error, sent 0 should read sent 2, so there is something weird with that in my smart pet planter code.py.

I have uploaded a copy of my code.py. Maybe I'm missing something.
code.py
(9.84 KiB) Downloaded 5 times

I'm really looking forward to sorting this out. I want to buy another titano and build another project.

Thanks!

Steve

PonyXpress
 
Posts: 48
Joined: Fri Jul 01, 2022 10:51 am

Re: help with the PyPortal Pet Planter with Adafruit IO and

by mikeysklar on Wed Jul 06, 2022 8:16 pm

Thank Steve,

Can you post a screenshot of your empty AIO dashboard. I want to confirm the feeds were setup since you are connecting which means your username and AIO key are good.

https://learn.adafruit.com/pyportal-pet ... ds-3053187

mikeysklar
 
Posts: 8097
Joined: Mon Aug 01, 2016 8:10 pm

Re: help with the PyPortal Pet Planter with Adafruit IO and

by PonyXpress on Wed Jul 06, 2022 9:03 pm

yes sir!

dash.JPG
dash.JPG (104.72 KiB) Viewed 237 times


devices.JPG
devices.JPG (98.61 KiB) Viewed 237 times


feeds.JPG
feeds.JPG (103.86 KiB) Viewed 237 times


Thank you!

PonyXpress
 
Posts: 48
Joined: Fri Jul 01, 2022 10:51 am

Re: help with the PyPortal Pet Planter with Adafruit IO and

by PonyXpress on Thu Jul 07, 2022 10:28 am

Hello,

Can you tell me the exact url or address that the adafruit device is trying to communicate with? While the "Internet Connect" code.py worked, I want to make sure that my Pi Hole ad blocker isn't part of the problem. I can whitelist the address to cover that base.

Was there anything wrong with my code.py file I uploaded?

Does my secretes file look ok?

What else can I try?

PonyXpress
 
Posts: 48
Joined: Fri Jul 01, 2022 10:51 am

Re: help with the PyPortal Pet Planter with Adafruit IO and

by mikeysklar on Thu Jul 07, 2022 1:44 pm

Your AIO setup looks correct. Assuming your AIO key and username match your secrets file the only obvious obstacle would be the Pi Hole on your network. Can you take that out of the equation by either disabling it or whitelisting?

mikeysklar
 
Posts: 8097
Joined: Mon Aug 01, 2016 8:10 pm

Re: help with the PyPortal Pet Planter with Adafruit IO and

by adafruit2 on Fri Jul 08, 2022 1:59 pm

paste your repl output - where is it failing?

adafruit2
Site Admin
 
Posts: 21071
Joined: Fri Mar 11, 2005 7:36 pm

Please be positive and constructive with your questions and comments.