HI! I’m back with updates from the UCSB capstone team.
To recap for anyone else this might help, the project goal given to us by our sponsors was to add a camera as a payload on the Bristlemouth system and establish a video livestream to be viewed onshore. We pretty quickly realized that’s not a realistic goal, so as of now our tentative goals are (roughly in order of what we think is most doable):
- Saving photo and/or video data to the spotter’s SD card, and sending an alert over cellular when the SD card is nearly full.
- Motion detection to tell the camera when something interesting is in the frame (when to start/stop recording)
- Computer vision to count how many shark or fish looking things come in frame, and sending that data with timestamps
- Sending a photo over the spotter’s cellular connection. This seems like a stretch, but we really don’t want to give up on it since it’s the closest goal to what our sponsors gave us.
A lot of these goals will be challenges to do with programming our microcontroller more than they will be challenges with Bristlemouth, so they’re not focused on in this post. Mostly here I’ll be talking about trying to send an image over cellular.
So far, we have a USB webcam and a Raspberry Pi 4 that we are using together as a payload connected to the dev board. We have established that we are able to power the Raspberry Pi from the dev board using a buck converter (thanks @NickRaymomd for the tip. We have been following your progress ). We are also able to control the webcam settings and take photo and video from the cam, saving them to the RPi. The bigger challenge starts now as we are trying to integrate it into Bristlemouth.
The first proof of concept was to send simple data from the RPi and read it from the Dev Board console. We started by following the guide Bristlemouth Dev Kit Guide: Integrating an RS232 Serial Sensor. We flashed the dev board with the exact app firmware provided in that guide, and connected the raspberry pi serially to the dev board using UART tx and rx. I pulled together a short script on the raspberry pi to send single byte of integers incrementing every second, and without changing any of the dev board app code at all we were able to read the bytes from the dev board console. Success so far!
This brings me to my first set of questions for the Bristlemouth admin:
- Uart is clearly not the ideal communication method for sending bulky visual data, but from what I have seen uart and rs232 are the only ones that have been developed so far. Do you have any other methods (SPI? dare I say USB?
) we should try before spending more time with UART?
- In user_code.cpp for the rs232 app it indicates that the buffer size for received UART messages is 2048 bytes. Is there a strict upper limit for that? Also, can we use any standard baudrate for the mote? Currently it’s set to 9600, but I would love to crank that up a notch if that won’t cause problems.
- Where can we look for resources on the uart commands? It’s hard to tell if these are standard compared to other cpp development environments or if they have been developed unique to bristlemouth.
For now, we’ve continued with our design assuming that UART is the best option and that 2048 bytes is the largest buffer that can be received from a payload. To get around that, I made a little program that will take any file (jpegs for now) and split its binary into individual binary files of an adjustable size (2048 bytes for now). Without fiddling with any camera settings, pixel width, or any fancy compression, the photos are coming out to be in the range 200 KBs, which translates to anywhere between 80 and 150 individual 2048 byte files. It’s a little awkward and getting a short video from the raspberry pi to the dev board will be significantly harder, but I think it’s doable. The plan is to send those packets to the dev board using code very similar to the RS232 example app and then route them one by one to the spotter.
The next step we will do is change the user code to send these buffers to the spotter and (for now) save them to files on the spotter’s SD card. Then we can remove the SD card and offload all those files to my laptop, where we can reassemble them into a single jpeg file to make sure that everything came through properly. It looks like Dev Kit Guide 5 should be a really good resource for that so we will continue using that as a reference. But… now comes the time for planning for how we will send this over cellular. Here’s my next chunk of questions:
- Is there a size limit on data that is sent from the dev board to the spotter? If we wanted to, could we send big files (like GB range video files to be saved on the spotter’s SD) through that pipeline in one go?
- I saw somewhere that there were issues sending data over cellular without iridium fallback. Right now I would rather not send data at all than rack up a fat Iridium bill. Do you have a workaround for cellular only sending?
- I am not a pro regarding the API, but I know that it’s not set up to receive the type of data we want to be sending. Can we build on the API to have it receive raw binary files that are downloadable? Alternately can we direct outgoing data from the spotter to an alternate destination, like a separate website where they can be held? What do you see as the best way to accomplish this?? It seems like it will be a big challenge.
- I’ve been piecing together bits of information regarding the cellular connection that I’ve read in various places and I’m not sure what’s relevant and what it means for us… First I saw that the cellular connection has no bandwidth restrictions. Then I saw that trying to send data larger than 340 bytes will cause an error. I think I also saw that we can only do uploads once every 5 minutes. Math is telling me that to send my 200KB of data I would need 590 packets sent over 49 hours… That’s not good… How much of this is true?
I think that concludes the questions and updates I have for right now. I’m hoping that y’all who know Bristlemouth’s ins and outs will have some insight on what is a good amount of a challenge versus what is an impossible challenge for us. We will keep updating as we continue! Thanks