This project is incomplete! I was unable to figure out programming the Thingy:53 in the time allotted. But I believe the theory is sound and I hope to finish this in the future.
RVs and travel trailers may not get quite as hot as cars in the sun, but it is still dangerous to leave pets inside without the AC running.
That isn't a big deal if you're at a campground with electrical service, but it creates a serious problem for people who like boondocking (camping off-grid). Unless someone has a substantial (and expensive) solar panel array and batteries, running the air conditioner requires running a generator for power. Such generator usage has disadvantages:
- It uses a lot of fuel, which campers have to haul along with them and that is quite costly right now.
- The generator emissions pollute the environment.
But pet owners don't have the option of leaving the air conditioner turned off when they're away and their pets are inside.
To solve this problem, I'm building a device I've dubbed "PetsafeRVcoolr" that can activate the generator and air conditioner in an RV or travel trailer when the inside temperature exceeds a set level.
Before I describe the device and its operation, it is best to cover the basics of RV electrical systems and air conditioners.
RV electrical systemsMost RVs have two separate electrical systems: 12V DC and 110V AC. 12V power comes from the battery bank and feeds many of the less power-hungry appliances, like lights, water pump, furnace blower, and more. The 110V AC system powers household-style outlets and power-hungry appliances like the air conditioning.
In a conventional setup, 110V AC is only available when an RV is connected to "shore power" (the electric hookup at a campground, for instance). Some people use inverters to change 12V DC power from their batteries to 110V AC, but inverters large enough to handle an air conditioner are expensive and they will burn through battery very quickly.
A common way to provide 110V AC shore power when boondocking is with a generator. Most burn either gasoline or propane and output 110V AC to the RV. If the generator is large enough, it can power the air conditioner.
GeneratorsGenerator fuel consumption depends on several factors, including: load, elevation, engine size, and more. Some smaller generators can run for 8-10 hours on a single gallon of gasoline, but larger models (which are usually necessary for air conditioning) might only last 2-3 hours on a gallon.
Inverter generators provide "cleaner" power, which is good for sensitive electronics. They output 110V AC, then convert it to 12V DC, then invert it back to clean 110V AC. While most people will recommend inverter generators, they are more expensive and unnecessary if users don't plan to connect any sensitive electronics.
Some generators have battery-powered electric start systems, while others have a lawnmower-style pull start. Of the generators with electric start, some models offer remote starting, which is an important feature for the operation of the PetsafeRVcoolr device.
Our original generator was a portable pull-start inverter model. But I was unable to devise a practical way to start that generator with the Nordic Thingy:53. So we upgraded to a larger generator that has remote electric start—something that will be very useful for this project.
An important factor to note is that generators cannot have a load connected when starting. Every generator manual will recommend that users start the generator and then connect loads (like their RV's shore power cable). Fortunately, I found a workaround for this that is crucial for the success of this project.
RV air conditionersAir conditioners in RVs and travel trailers can be broadly categorized as either "ductless" or "ducted." The latter is akin to household central air conditioning, while the former is more similar to a window air conditioner unit.
Most of these models (especially ductless models) do not have thermostat control. The user can set the cooling level, but the air conditioner will just continue running until they turn it off.
For the purposes of this project, that means that even if a generator were very efficient without a load, it wouldn't matter because the air conditioner would always run until the user manually turned it off.
If someone has an RV air conditioner that turns on and off through thermostat control, PetsafeRVcoolr may not be necessary. In that case, a generator running in "eco mode" may consume very little fuel when the air conditioner is off.
The rest of us need a solution...
ObjectivesThe primary objective of this project:
- When inside temperature exceeds a set level, turn on the generator and air conditioner
Secondary objectives:
- Send LoRa notifications to a device that pet owners can carry with them while away from their RV
- Allow users to activate the generator and air conditioner remotely through a LoRa device
- Send status through cellular, which users can check on their smartphone
- Allow users to activate the generator and air conditioner remotely through cellular
- Machine learning-based fault detection
This is the easiest part of the entire project. The Nordic Thingy:53 has a host of built-in sensors, including an environmental sensor that can detect temperature and humidity.
Powering the Nordic Thingy:53 is also easy, since an RV's 12V system is always active. A simple 12V-to-5V power adapter meant for car cigarette lighter outlets is a very affordable and readily available product. With that connected to the RV's 12V system, it can supply the required 5V power to the Nordic Thingy:53.
The Thingy:53 is fairly efficient and won't make much of a dent in a typical RV battery, even if it is on all the time. But to further increase efficiency, we can put it into a sleep state and wake it up at regular intervals to check the temperature inside the RV.
Generator remote startOur generator has remote electric start capability. It came with a small key fob with two buttons: one to start the generator and one to shut off the generator.
It is easy enough to connect the button traces on the key fob PCB to the I/O pins of the Nordic Thingy:53 so that we can "press" them programmatically.
So the process will look something like this:
1. Wake from sleep state
2. Check temperature
3. If temperature is below threshold: press key fob "off" button
4. If temperature is above threshold: press key fob "on" button
5. Return to sleep state for 5 minutes
Turning on air conditionerThe above steps start up the generator or shut it off, but what about the air conditioner?
While we could connect a relay to the air conditioner's 110V AC power cable, that isn't necessary. We can just leave the air conditioner's control set to cold all the time.
When the generator is off, the air conditioner won't do anything because there is no 110V AC power. When the generator turns on, the air conditioner is already set to cool and will start as soon as it starts receiving 110V AC power from the generator.
Generator load at startAs I mentioned previously, one should not start a generator with a load connected. The air conditioner certainly qualifies as a substantial load, which is why relay control of the air conditioner sounds like the proper solution.
But remember that we have to leave the RV's shore power cable connected to the RV at all times. Even with the air conditioner disconnected through the relay, everything else in the RV is "on" and represents a load. That includes the 12V converter, battery charging, refrigerator (if set to switch to AC automatically), and anything else connected to the 110V AC system.
This was a problem that I spent a lot of time thinking about until I realized something: our surge protector has a startup delay.
RV surge protectorsA quality surge protector is a must-have for any RV or travel trailer owner. They protect delicate RV electrical systems from power surges that are common in campgrounds.
There are many models on the market, but I noticed something interesting about my Southwire Surge Guard model: it imposes a 128 second delay when connected before it will pass power to the RV's shore power cable.
That delay is meant to protect the air conditioner's compressor, but it also solves the problem of the generator starting with a load.
When the Thingy:53 presses the key fob button, the generator starts with almost no load (since the surge protector disconnects the shore power until the 128 seconds pass). In reality, there is a tiny load: the surge protector's own internal electronics. But that should be so small that it won't have an effect.
After 128 seconds of the generator running, the surge protector will allow power to pass to the RV's shore power cable and then the air conditioner will begin running.
For these reasons, it is imperative to use PetsafeRVcoolr with a surge protector that implements a similar delay in order to eliminate load when the generator starts.
Building the PetsafeRVcoolr deviceHere is a list of the parts needed for this project to achieve the primary objective:
- Suitable generator with remote electric start
- Surge protector with startup delay
- Nordic Thingy:53 development kit
- 12V-to-5V USB-C power adapter
- Protoboard
- Single NeoPixel RGB LED
- 3x tactile momentary push button
- 3D-printable enclosure
We don't only want PetsafeRVcoolr to work automatically—we also want to be able to control it manually when we're there in the RV.
For that reason, we want to implement a simple control interface. That's where the momentary buttons come in:
Button A: toggles automatic/manual operation
Button B: starts generator
Button C: stops generator
Button A is important because it will keep PetsafeRVcoolr from automatically turning the generator on or off when we don't want it to. Buttons B and C simply let us replicate the functionality of the key fob that we hacked.
The NeoPixel RGB LED provides status indication. We can set it to blue when it PetsafeRVcoolr is in automatic mode and green when PetsafeRVcoolr is in manual mode. Other colors might represent other status conditions in the future (errors, cellular connectivity, etc.).
Feedback and power monitoringNotably, PetsafeRVcoolr doesn't have any way to detect if everything is working as intended. It doesn't know if the generator is running, if the RV is getting 110V AC shore power, or if the air conditioner is running.
But we can expand PetsafeRVcoolr's capabilities so that it does know those things. With just a small "Mains Detection Module" or even a basic optocoupler, the Thingy:53 can check if power is flowing through the RV's 110V AC system.
The primary reason to do this is to add a second and third layer of protection, which means that pets are even safer. This would account for the possibility that the generator didn't actually start, the surge protector failed and isn't providing a shore power connection, or a breaker tripped.
If the Thingy:53 detects that 110V AC power isnot flowing when it should be, it can attempt to start the generator again. If that fails again, it can send a notification via cellular or LoRa.
But additional hardware may not be necessary...
Machine learningWithout the hardware mentioned above, the Thingy:53 cannot directly determine if the RV's 110V AC power system is active. But it can indirectly infer the status based on temperature readings.
It is reasonable to assume that the temperature inside the RV will begin decreasing after PetsafeRVcoolr turns on the generator. If the temperature remains the same or increases, then that would indicate a problem somewhere.
But explicit programming for such conditions is tricky, because temperature changes are hard to predict. For example, the temperature may continue to rise inside of the RV for a short time even after the air conditioner starts running.
For that reason, it might be worthwhile to implement a machine learning model. Edge Impulse is perfect for this, because it runs on microcontrollers without internet connectivity and it setup for the Thingy:53 as a deployment target.
To get this working, we would need to train the model on normal conditions. It would need to see the data from several iterations of successful PetsafeRVcoolr activations in a variety of temperature and humidity conditions. After that training, it could raise a red flag any time it sees conditions that deviate from the norm.
For now, this is a secondary objective. While I believe it is a good idea, my experience with machine learning is limited and I'm unsure of how to gather the necessary training data. It seems like it would be difficult to collect the data by running through the process in the real world, since I would need to go through the process many times (each time taking 15-30 minutes) in many weather conditions.
So if anyone has suggestions on a more practical way to train the model, I'm all ears.
Comments