A couple months ago, I purchased an AstroCam from Estes, and was thrilled with the video and audio that I got from the model rocket launch. It was so cool to see video from the perspective of the model rocket! However, it also gave me the urge to make my own so I could add additional functionality (ie altimeter) to see how high my model rocket was flying.
I ended up getting the Estes Ghost Chaser model rocket, which has a small clear payload section. I also had a Seeed Studio Xiao ESP32 Sense, which came with a small camera, SD card slot, and the ability to connect to a battery. It would be the perfect MCU for the rocket! I also got a small form factor BME280, which is an atmospheric pressure sensor that can be used to get temperature, humidity, and altitude data. I connected this sensor to the Xiao ESP32S3 Sense via I2C.
Fortunately, the dimensions of the Xiao just barely fit inside the payload section of the Ghost Chaser. I had a cylindrical LiPo battery lying around that I wired up to connect to the Sense. With an SD card and some Arduino code to read the sensor values from the BME280 and save frames as jpeg photos, I was ready for launch. (Note: if anyone figured out a way to save video to the SD card with the Sense, please let me know. The sample code on Seeed Studio's wiki only saved the last frame to the video).
My first test launch actually went pretty well. The chute deployed and the rocket came to a soft landing in the field. However, I noticed that the camera light was not on when I recovered the payload, and came on after a couple minutes. When I got home to look at the data, my fears were confirmed when I looked at the SD card contents. Most of the photos were when I retrieved the rocket, and not when I launched. My guess is that the acceleration of the rocket caused the Xiao to reboot. However, I was able to get some good photos before the MCU rebooted! See below:
Provided the weather cooperates, I'm going to try to fly this setup a few more times to see if I continue to have the reboot issues. If there are any model rocket experts out there that have recommendations on stabilizing payloads for shock, then I am all ears! I'm looking forward to trying this out again and hopefully expanding the functionality. Happy making everyone!
UPDATE (7/29/23): I had a feeling that the reboot was due to the secondary charge from the engine that pops off the nosecone and deploys the parachute. So I added a piece of foam on the bottom of the nosecone to buffer the shock. I also taped the battery connector to make sure that didn't disconnect during flight. And it looks like it worked! The Xiao operated through the entire flight, and I was able to generate a video and collect environmental data!
You can see from both the video and the data that the rocket ends up at a higher point than when it started because it got stuck in a tree! Fortunately I was able to retrieve it the next morning and download the data.
Next step is improving the framerate of the video. Right now I just save individual frames to jpegs on the SD card and then create a video after using a video editor. I imagine those frequent writes slow it down. I'm seeing about 1 frame per second at SVGA resolution (800x600) with this method. If anyone has any ideas on how to speed up the fps, please reach out! Thanks!
UPDATE (8/1/23): Thanks to the amazing code by s60sc, I leveraged ESP32-CAM_MJPEG2SD to get a much higher frame rate (up to 20 frames/sec) while also recording as an avi file to the SD card. An extra bonus was it captured audio using the Xiao's PDM microphone as well! The only major changes I needed to make was to add a task and handle for my BME280 sensor and integrate it into the code. It took me a couple nights to figure out (I'm not strong on thread execution), but I got it working. And today's launch was amazing!