Foodie is meant to be a modular end to end weight sensor network that allows you to track food usage, provide statistics, recommend shopping lists and even more. Combining a Raspberry Pi 2 running the Windows 10 IoT Core, a Teensy, Spark, Cassandra, and Azure we get an end to end sensor consumption service that is capable of tracking food usage and tying it to individual barcodes.
What Does Foodie Do?
- Live tracking of weight sensors
- Web Interface to view sensor data and upload barcodes
- Upload barcode images and tie a product to the sensor
- Integrates a barcode API to get product information
1 Fish – Getting Started
2 Fish – Hardware
Red Fish – Setting up the Backend
Blue Fish – Linking It All Together
1 Fish – Getting Started:
This project relies on various different pieces that range from running on the Raspberry Pi 2 to running in the Cloud. In the following sections you will learn everything from how the project interacts, to where and how to buy the pieces, as well as how to get everything up and running.
First off, some general notes about this project.
- I opted to use a Teensy instead of an Arduino to make sure I could make the form factor I wanted. However I have included code that will run on an Arduino Uno which takes advantage of the SoftwareSerial Library to emulate a UART connection on pins 10 and 11.
- The project was designed to be fairly modular in the sense that, the backend could be stripped to support a wide array of different sensors and modules that need streaming support. By all means break apart the code base and use it, the Event Hub and Spark streaming pieces are great for just about any sensor network.
Initial tools to get ready
- Visual Studio – You will need at least the Community edition to compile and deploy the C# Raspberry Pi Hub to the Raspberry Pi
- Arduino IDE – This will be needed to deploy the weight sensor firmware to the Arduino. OPTIONAL: If you opt to for the Teensy you will also need to download the Teensy plugin for the Arduino IDE.
- Azure Account – This project relies on an Event Hub hosted in Azure and my example takes advantage of an Azure VM as well as an additional Azure SQL Database.
- Soldering Iron – This is optional however if you want to package it all up inside the case you will want to solder the connections directly.
- Outpan API Key – You will need this a little later on, it is the Barcode API Key.
- 3D Printer or Something Similar – If you are interested in printing out the housing, you can find the STL files in Foodie/STL
2 Fish – Hardware:
A few things worth noting about this circuit.
- When connecting the JY-MCU unit to the Arduino remember that the TX port on the Arduino connects to the RX port on the Bluetooth module and vice versa.
- Use one GND pin for the Force Sensor and the other GND pin for the Bluetooth Module and USB Battery Charger.
- On an Arduino Uno, simply connect the TX and RX pins to pins 10 and 11.
Red Fish – Setting up the Backend
The backend to this project relies on 4 major parts.
- Bluetooth Connected Arduino
- Raspberry Pi 2
- Azure Event Hub/Spark Streaming Job/Cassandra
Bluetooth Connected Arduino
- Navigate to the root of the project
- Open the “WeightSensorFirmware – Uno” or “WeightSensorFirmware – Teensy” folder and open up this file up in the Arduino IDE
- Side Note: If you are using a Teensy, ensure you have the following package installed. http://www.pjrc.com/teensy/loader.html
- Click on the sideways arrow in the upper left of the IDE to begin the upload process.
- That's a wrap folks! That's all it takes to get the Arduino ready to talk to the Raspberry Pi 2.
For more detail: Foodie © GPL3+