RFID Fridge

A smart refrigerator for the home

Software
Copyright FreeRTOS, http://freertos.org
Overview

For easier integration of ethernet, and separation of the software for our devices in general, we decided to use FreeRTOS (a free, real time operating system). FreeRTOS provided us with a thread scheduler, semaphores, intra-thread queues, and more. Internally, it uses the Cortex's SysTick timer internal timer for thread preemption. While it had an initial learning curve, it made working with many devices easier to use.

Software Layout

The system is comprised of several tasks (threads), which perform their respective functions, and deliver data to other tasks.
Control:

State machine for processing incoming barcode and RFID data. Tied into the inventory system to determine pairing of barcodes and RFID, insertions/removals of RFID tags, etc.

RFID:

Driver task for the RFID device. Waits for interrupt from the RFID device, then reads last tag.

Barcode:

Driver task for the Barcode device. Waits for interrupt from the Barcode device, then reads the last UPC scanned.

Sensor:

Polling task for additional sensors. Used for temperature sensor input, polls the sensor on a timed interval.

Network:

Processing loop for uIP (TCP/IP stack). Responsible for running the webserver (HTTP server responses), as well as client requests.

Layout Diagram
Difficulties

There were a few minor difficulties we encountered while learning how to use FreeRTOS, but nothing overly significant. The largest unexpected issue was that the Microsemi provided NewLib implementation of printf required a larger stack size than expected. Because each FreeRTOS task initially had a very small stack by default, using printf with variable parameters yielded corrupt results. Solving this issue was very necessary, as we used variants of printf not just for debugging but for the screen and webserver.

External software used

FreeRTOS - lightweight operating system / thread scheduler (http://freertos.org)
uIP - lightweight TCP/IP stack (http://www.sics.se/~adam/uip/index.php/Main_Page)
uthash - lightweight, simple hash table / linked list implementation (http://uthash.sourceforge.net)