Going Wireless. Again.

One of the good things about a hobby project is that you design and build stuff and the let it wait for a couple of weeks because you have other things to do. Why is that good? Because you’re the first user that will need documentation when diving back into your stuff.

I decided to implement the Wifi controlled Kayra now, for this, I need to get back to the project part where I connected the IMU to the servo controller and the ESP 32 Cam. The change there in context of Kayra as a humanoid is that the servo controller acts as I2C slave and gets the commands from the ESP 32.

For this, there needs to be a reliable connection over Wifi with the host and the IMU needs to be inbetween so that it can be read out via the ESP 32 now (as this is now the master).

The final goal for the moment should be the following functionalities:

  • move servos over Wifi, upload animations and poses
  • read the IMU over Wifi and stream that data to host
  • stream ESP 32 Cam’s video over Wifi to the host for computer vision

Okay, when reverse-engineering myself, I have a couple of questions:

  • I have a USB-to-serial connection to the ESP 32, I need to set the ESP to “programmable” sometimes, that was done using a jumper.
  • What is the software on the ESP to read the IMU and write to the servo controller?
  • What is the software for the controller? If I’m not working via USB anymore, how do I check if it’s working? I think I somehow had two monitoring softwares to check the connection between ESP32 and servo controller.

Furthermore, I need to reactivate the Wifi router to connect via 2.4 GHz with the ESP 32 (as my version doesn’t support 5 Ghz, which was a lot of pain to find out!). I decided to start with the ESP 32, this is what I found on my desk:

USB to serial still connected, no jumper on the ESP 32 and IMU still connected, so the pins should work as they did. Hopefully.

I’ll power that part via the USB to serial and check on the host whether I’ll get some connection via Wifi. In my original article, I wrote about the clientWifi.py, so let’s fire that up on the host.

Okay, is the ESP connected to the Wifi? Does it have a different IP address? Dunno. Maybe I should connect via terminal and USB to see what it does. I haven’t seen a device on my router yet.

I remembered that I was connecting via Thonny:

Okay, restarting via Thonny (“stop button”) leads to the REPL on the ESP32:

And on the lower left, we see all the files that are on the ESP’s file system. My last post on the topic stated that I ran serverWifi.py on the ESP, let’s see.

Yes!

Okay, but the host still delivers the same error message.

Connecting the PC to the same router allows me to see and ping the ESP32:

Okay, so why does the client software not connect? Finally, I found out that the server IP the ESP32 was listening was not the IP address it received from the router’s DHCP, so I added a line on the ESP 32’s side to print out its current IP address:

Then also the host will connect:

Now, we have a bi-directional connection between the two. This connection is blocking at the moment, this means that the PC will connect then you need to enter a text (“ding” in the screenshot above) and change over to ESP’s REPL in Thonny and enter the response (“dong” in the black screenshot).

But at least, we have the system working again!

Learning should be that once I get the display working on the ESP, I’ll print out Kayra’s IP address.

Next step will be to try out the commandViaWifiToI2C.py on the ESP that actually sends data to the servo controller via I2C.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *