[ITP: ConnDev & SoftRob] Lungs III

This is a continuation of my previous blog post.

Connected Devices

API call errors

After doing some duration testing of my API calls I learned I had a problem. Twice I had been running my code for multiple hours and after some time I saw that I would get repeated errors from my HTTP get requests. I wasn’t able to get to the bottom of WHY this was happening because I don’t have the time for that right now, but Jeff Feddersen suggested I implement a watchdog timer. The way this works is the timer is configured to reset before a given time interval. If it’s not reset in time, the SAMD21 resets and executes the code from the top. In my code, I keep track of how many error codes I receive in a row. If it’s more than three the code falls into an infinite while loop forcing the the watchdog timeout to occur without being reset, so the whole sketch will start from the beginning when the MCU is reset.

Soft Robotics

Programmable Air? Pumps?

Once the API calls were coming in reliably, it was time to see if the Arduino Nano 33 IoT is compatible with the Programmable Air. Admittedly, this should have been one of the first things I tried because the plan was to make internet connected air pumps, but I quickly learned it wasn’t. The Programmable Air examples don’t compile for the 33 IoT, the EEPROM library isn’t compatible with the MCU. I tried duplicating the library and commenting out all the EEPROM stuff that was mainly using for storing pressure readings (I don’t need that, right?) and the timing control example compiled. I could hear the valves clicking but the pumps didn’t turn on.

This is the Programmable Air (PA) pinout. It shows that the pumps are connected to D10 and D11 of the Arduino Nano. In the switchOnPumps() function in the PA library an analogWrite for both of those pins turns on the pumps at a certain power. I checked the Arduino 33 IoT pinout and D10 and D11 don’t seem to be analog pins and a digitalWrite of those pins didn’t get the function working for me. I’m not exactly sure of what makes the Arduino Nano 33 IoT incompatible with the PA but I had to shift gears.

I had my own pumps already because step Z was to build up my own pneumatic system because the PA isn’t mine. The Adafruit product page says you can drive the pumps using a standard motor driver. I soldered header pins to the DRV8833 and wired it to my Arduino Nano 33 IoT and it worked! Don’t forget to pull the SLP pin HIGH. And then I hooked up a second pump, for inflation and deflation, AND THAT WORKED TOO! I’m a genius and reinvented the PA. Jk, the Programmable Air is much smarter than this simple setup!

The image below shows the full two pump system. To the right is a quick schematic I sketched and the circuit prototype below.

The pumps aren’t rated for continuous use so I plan to write code that only does a “breathing” cycle every few minutes.

Air bags

The paper air bags proved to be too leaky in all my past testing, so I decided to change my vision a bit. I cut the lung shapes from the vinyl fabric, sealed the edges of the air bags with an iron, and glued a paper bag skin. Fingers crossed this will work once they’re interfaced with the pumps!