I’m planning my first Spark project. (Huzzah!) It’s a port and expansion of an existing Arduino project. Once I get a little further along, I’ll provide more information and details, but for now I was hoping to get some ideas and counsel from the community on one aspect of the project.
The device I’m designing uses cartridges that are single use. I want to assign a GUID to each cartridge that we ship, and I want the device to read the GUID and send it to a central server along with data generated by the device.
The cartridge has to be very low cost (no electronics) for the economic model to work, so I can’t use RFID tags. My plan is to use a bar code or (ideally) a QR code. The GUID would only require a Version 3 QR, so it could be pretty small, giving me lots of flexibility as to location on the cartridge.
The location of the QR code would be fixed, and the CMOS camera would be fixed (both location and focal length), so there shouldn’t be much variation in the image to be read.
I’d like to use a small, low cost CMOS camera/sensor to read the QR code. It only requires a single B&W image, so the data transmitted is relatively small (I’m figuring 6x6mm, or 1/4" square, which at 300dpi would mean 45K of data if I use the Y channel of the camera as 8-bit grayscale, or only 5.6K if I read B&W).
I’ve looked into sensors, and the Omnivision OV7670 seems to be a good choice. It’s old-ish technology, but good enough, still readily available, and cheap. Since I don’t need great resolution, I think it should work.
It appears to be controlled by the I2C bus, and use DMA for data transfer. I’d love to find a library that can get me started, but the only stuff I can find is for the STM32F4 processor, rather than the STM32F103.
I was going to try to use the existing libraries I’ve found out there and adapt them for the Spark. I figured I’d use the Spark I2C library, and refactor the OV7670 library to work with the STM32F103 on the Spark. There are cheap ($10-15) breakout boards for the OV7670 I can use to prototype, although eventually all of this will be integrated into a single board for the production device.
If I can get that to work (and that’s a big if, as I feel like I’m a kindergartener who is about to start a triathlon ;-), I would grab the image and send it via WiFi to my server, and use jsqrcode, a node.js QR reader, to decode the GUID. This would then be checked against the database on my server, and if it is a valid GUID, the device would get a validation response (or a rejection, if no match is found, which would trigger a limited number of retries before failure).
Anyway, here are some questions for the gurus here:
- Does the overall plan sound feasible?
- Any ideas for improvements, particularly simplifications?
- Any concerns about using the I2C library for controlling the OV7670? The data sheet says its SCCB bus is compatible with I2C, but I read conflicting reports on the web.
- Any advice on how to get the image data from the camera to the Spark Core? I’m assuming theres a way to use DMA, but I’m not sure.
- Any other warnings, advice, helpful hints, ideas, or comparable projects you can point me to?
Any help would be greatly appreciated. I’m itching to get started and learn the Spark Core environment! It looks awesome.