He's your average four year old with a big imagination. He is an amazing kid, he's learning how to ski, and he has several unique and remarkable characteristics. In fact, one of his unique traits happens to be the motivation for this project; his life threatening allergy to EGGS.Food Allergies
If you're a parent of a child with a severe allergy, then you are all too familiar with the undue stress that goes along with the most mundane daily activities. The only respite that can be found is in either the magical elixir of Benadryl (diphenhydramine) or the EpiPen (epinephrine/adrenaline). Thankfully, Benadryl is inexpensive and almost always works if there is enough time for the drug to take effect. However, once the window for taking Benadryl has passed, you only have one option remaining, and that's Epinephrine. Unfortunately, at $136.11 an EpiPen, epinephrine is a "not so affordable" solution.
I was gobsmacked the first time I was informed the price of Epinephrine. It's absolutely something you can't live without, but you can hardly afford to possess.
Next, you are informed by the pharmacist that the medicine itself must be kept at room temperature. Room temperature is defined as 20-25C (68-77F). At first that doesn't seem so bad, until you begin to realize that you must keep the EpiPen with you at all times. This includes kids ball games, summer vacations, as well as travel in planes, trains and automobiles. In practice, this becomes exceptionally difficult; especially in automobiles (placed on a hot dash or left in the car when you go into Walmart).
Okay, so what happens when you mess up? Unfortunately, when an EpiPen gets too hot, it begins to break down and lose its potency. Can it still save your child? Maybe. However, this begins to defeat its entire purpose for being. Can you imagine using a weather worn and frayed safety net under a tight rope? In a matter of thinking, the EpiPen is your child's absolute last chance at survival. As such, it's not a risk most, including myself, are willing to take.Assessing the Problem
The biggest, and most obvious, problem is temperature. Yet, trying to solve for temperature begins to give way to other problems. However, before we go into all that, let's solve our most pressing issue. How to mitigate excessive heat exposure.
You can try to control the temperature by maintaining a more consistent atmosphere. A quick Google search will help you find several insulating jackets. The one I found most compelling was created by a young maker who is trying to solve this problem for his own EpiPens. He has invented an advanced, insulated carrying pouch, he calls EPI-TEMP.
I purchased the EPI-TEMP pouch almost as soon as I stumbled across it. However, it's obvious it will still fail eventually, and, unfortunately, you will have no idea how to gauge if/when it has failed. Remember, in order to ENSURE the safety of your child, you must KNOW the EpiPen has NEVER seen prolonged exposure to heat. EPI-TEMP is clear and important step towards being able to successfully carry EpiPens with you at all times, but it's not enough.
Another problem you will quickly encounter is that you must constantly be aware of where the EpiPen is at all times. This task sounds simple enough, but is not so easy in practice. Have you ever lost your keys? It's hard enough to find them when you want to go to the grocery store, now imagine trying to find them with the additional stress of a ticking time-bomb with your child's life in the balance.
As if this weren't hard enough, these dangers are compounded by the fact that the EpiPen doesn't need to be lost, rather merely forgotten in the car while you step into a grocery or convenience store. This threat could be easily averted if there were some form of an alerting system that could inform you when such an event has occurred.Origin of EpiCAT
Whether it's my child or just my pocketbook, I cannot afford (literally or figuratively) to allow my EpiPens to suffer prolonged heat exposure. To prevent this, I decided to make a solution that solved for three primary objectives:
- Thermal Watchdog
- GPS Tracking
- Cellular Connectivity
First and foremost, I need to know the instant when it is too hot. I discovered the LM75A, a TI chip found in many thermostats. It generates a latching interrupt once a thermal boundary has been exceeded, and will stay in that state until the temperature has dropped back below a hysteresis point.
As far as GPS is concerned, there are two main objectives to accomplish:
- Primarily, I need to know where to find the EpiPen during an emergency.
- Otherwise, I need to know where to find the EpiPen during a thermal event (to save the medicine from prolonged heat exposure).
Now I work for Blues Wireless, so I knew the Notecard will not only solve both the remaining GPS and connectivity objectives, but will also bring with it low power consumption - which greatly benefits the solution.
The Notecard's onboard GPS can be configured to periodically enable GPS when the Notecard is in motion, then stop when motion is no longer detected. This is perfect for my application, because it will show me the last known location of the EpiPen. The Notecard can also provide an instantaneous GPS reading, which can help to locate EpiCAT during a thermal event.
Cellular communication with the Notecard is even easier to configure than GPS. A single JSON command will associate the Notecard with my Notehub account. Once I can push messages to Notehub, then I can easily route them to Twilio and on to my cell phone.
At this point, I can monitor the temperature of an EpiPen in real time, and when the temperature exceeds a predefined threshold I can send a message to my cell phone along with GPS coordinates so I can rescue the EpiPen before it starts to deteriorate.
Now I have a functional bench prototype, but what about deploying it to the field. Before you can send anything into the field in good conscience, you need to accomplish three main goals:
- Long Running, Resilient Firmware
- Battery Efficiency
As I previously stated, this device is for my 4-year-old son to carry. The last thing I want is a LiPo fire in his backpack. I designed a 3mm thick battery enclosure, encased in a 2mm shell for the PCB and antennae. I have durability tested this design by dropping it out of a moving car onto the highway. It survived that test, and I feel confident it can survive the torture of my 4-year-old's backpack. I've shared those designs in the Attachments section.
Regardless of your skill level, long running and resilient firmware can be tall order. Luckily, the programming model of the Notecard virtually eliminates this concern. The Notecard is designed to put the host to sleep, and only awaken it when a noteworthy event has occurred. For instance, I only need to intervene with the host MCU when a thermal alarm has occurred. When your host is "sleeping", it's really just powered off, so this means it's not leaking memory or looping on a bizarre edge case that only occurs due to some long running variable drift. In fact, any memory you may have leaked will be reclaimed once your device is powered back on. All the sudden, your firmware doesn't have to be perfect, because the Notecard is the long running process.
Battery efficiency falls into the same category. The Notecard idles at 8uA, which is less than the idle discharge rate of almost all LiPo batteries. When your host is asleep (disabled) it is not drawing any current, and therefore not wasting any battery.By letting the Notecard operate in the manner in which it was designed, you can short cut the long tail of field hardening your device and get it in the field faster.Mechanism of Action
Now that you fully understand the problem and the design of the solution, this section is intended to describe how all the pieces tie together.Hardware/Firmware Flow:
LM75A constantly monitors temperature. Once the temperature exceeds a certain threshold (25C/77F) then a signal pin latches
HIGH. The Notecard is monitoring this signal using an interrupt attached to one of it's four auxiliary GPIOs. The Notecard
ATTN pin (which is attached to the host MCU's
ENable pin) fires and wakes the host MCU. When the host wakes, it samples the temperature from the LM75A, requests the system voltage and current GPS location from the Notecard, packages all this information together in a "Note", and sends it to the Notecard marked to be immediately delivered to Notehub.
If there is not a temperature event, the Notecard will sit at idle and only wake the MCU periodically. When the host wakes, it will still sample the temperature from the LM75A and requests the system voltage from the Notecard. However, it will not engage the GPS module. Instead, the ESP32 will check if the Notecard has detected motion, and, if so, it will scan for nearby wireless access points to perform Wi-Fi triangulation. All this information will be packaged together as a "Note", and sent to the Notecard for delayed delivery to Notehub.
EpiCAT Hook-up Diagram | LM75A |
====================== | |
| V G S S |
| C N D C O |
__________________, | | | | | ,__________________
ESP32 | | | | | | | NOTECARRIER-B
| | | | | | |
| | | | | '--------|AUX1
| | | | | |
| | | | |
| | | |
| | |
Once the Note has been received by Notehub, it is picked up by a preconfigured "Route" that is watching for a specific Notefile. There, JSONata is used to transform the data to meet the Twilio API and forward it onward. Once the Twilio API is invoked, then I will receive a text message with one of the following messages. asdf
EpiCAT THERMAL ALARM: 91.4F
Field Test #1: Disney World (in July 🥵)
Warning: Low battery (3.38V).
Please charge EpiCAT.
Shortly after I completed the EpiCAT prototype, it was sent on its first field test to Disney World.
Florida summers are hot, hot, hot, and the EPI-TEMP pouch held up to the hot Florida sun! I knew this for a fact, because EpiCAT fits neatly into the EPI-TEMP pouch, which was carried inside my son's backpack. The temperature reached a peak of 28.5C inside EPI-TEMP, but EPI-TEMP held strong and never let the temperature exceed 30C, the short-term max temp for EpiPens.
Another factor to contend with, is that Disney World is notorious for having poor cellular connectivity. Fortunately, the EpiCAT uses a WBNA Notecard with a diversity antenna (to get signal in tough places), and it performed spectacularly! It checked in at it's regularly scheduled intervals, and steadfastly reported the temperature, location and voltage.
Finally, with the low-power model of the Notecard, I was able to charge EpiCAT before it left home, and I didn't need to recharge it until it returned a week later.
Hot on the heels of my success at Disney World, I was feeling carefree when carrying the EpiPen with me. In fact, I got outright lazy.On a warm Saturday morning, I threw Jude's EpiPen in the back of my Jeep as we loaded up to head for the local Farmer's Market. There is a lady at the market who makes vegan cinnamon rolls especially for Jude, so the Farmer's Market is a staple of our weekends. The morning was in the low 80's, and my guard was down.
After we returned from the Farmer's Market, we were excited to run inside and start gorging ourselves on cinnamon rolls. In our haste, we (I) forgot all about the EpiPen in the car. My phone had died while we were at the Farmer's Market, so I put it on the charger when I got home. About three hours later I turned on my fully charged phone, only to receive a slurrly of text messages from EpiCAT; warning me the EpiPen was in danger.
According to EpiCAT the temperature inside the EPI-TEMP pouch had exceed 44.5C/112.1F. This seems to have been reasonably accurate, because the indicator fluid inside the EpiPen itself agreed the EpiPen had become compromised.
Again, EpiCAT did it's job flawlessly, but unfortunately, I failed to do mine.Summary
I can't image not having EpiCAT, now that I've seen its benefit; it is a must have for those who carry an EpiPen. It takes an enormous weight off your shoulders, and feels like you have a sentinel on duty; protecting your kids at all times. Not to mention, the cost of the parts is less than or equal to that of a single EpiPen.Technically speaking, the Notecard is the real hero here. EpiCAT was relatively easy to put together thanks to the Notecard serving as the core of the solution. To be completely transparent, I discovered a memory leak in my code while writing this article. Part of what's so amazing about the Notecard, is that my leak had no impact on EpiCAT's long running memory consumption. The host MCU spends the vast majority of its time asleep/disabled, meaning the memory is released and reallocated each time it is enabled. If you stop to consider the technical functionality offered by EpiCAT, versus the incredibly small about of effort it took to put together the value of the Notecard/Notehub is undeniable.
EpiCAT has exceeded all my hopes and expectations! I hope it can serve the parents of other children who require an EpiPen. This project is near and dear to my heart. If you are trying to recreate the project and are struggling, please reach out in the comments below.Links