Detailed Description
Our design is consisted of three parts: Hardware implementation, cloud data handling and iOS mobile app.
Structure
First, the actual Egg Tray embedded with micro-controller reads in the egg data from the pressure sensor we built into the egg tray. This provides the raw data for our whole system. Consider the nature of refrigerator and our planned product, the egg tray part is fully powered by AAA batteries. Those data from the pressure sensor are read by the 10bit ADC analog signal acquisition module built in micro controller.
Then the data goes to an Edison board serves as the datauploader, using the 2 wire interface I2C. It requests the egg data from the micro-controller on the egg tray. This action happens based on timer - it would not request data that often, currently, it's requested once per minute.
After gathering data, the Edison board will preprocess the data a little bit and push the necessary data on a even slower timing basis to the DynamicDB of Amazon Cloud Service. It also handles some of the special cases. The uploaded data would demonstrate the change of egg presenting states with few database entries following time stamps.
There is also a data monitor on the EC2 of Amazon Cloud Service to constantly monitor the status of eggs through the constantly updated data stored in DynamicDB. It would send warning and reminder message to user through email or SMS telling them 'it's a good time to bring some eggs on your way home' or 'some of your eggs in egg tray are too old, it might be harmful to eat them, please buy some to replace".
On user's side, we built a iOS App on user's smartphone that would allow user to monitor the status of the egg, giving information like when the eggs were bought(put in), how long it has been there , and , of course, how many eggs in the tray.
Then the data goes to an Edison board serves as the datauploader, using the 2 wire interface I2C. It requests the egg data from the micro-controller on the egg tray. This action happens based on timer - it would not request data that often, currently, it's requested once per minute.
After gathering data, the Edison board will preprocess the data a little bit and push the necessary data on a even slower timing basis to the DynamicDB of Amazon Cloud Service. It also handles some of the special cases. The uploaded data would demonstrate the change of egg presenting states with few database entries following time stamps.
There is also a data monitor on the EC2 of Amazon Cloud Service to constantly monitor the status of eggs through the constantly updated data stored in DynamicDB. It would send warning and reminder message to user through email or SMS telling them 'it's a good time to bring some eggs on your way home' or 'some of your eggs in egg tray are too old, it might be harmful to eat them, please buy some to replace".
On user's side, we built a iOS App on user's smartphone that would allow user to monitor the status of the egg, giving information like when the eggs were bought(put in), how long it has been there , and , of course, how many eggs in the tray.
Data Aquisition
The raw data was provided by piezoelectric sensor which could provide data for how much pressure had been put on there. In our case, we are using its role as resistors.
It would serve as a resistor with resistance up to 100M Ohms.
When no pressure is applied to it, it will be at the maximum resistance; as force applied on, the resistance would decrease regarding to the magnitude of the force. This allow us to measure the data by voltage using a voltage divider with a reference
resistor connect with it.
Worth enough to notice, this type of sensor is not that accurate, it could have up to 10% error by the nature of the sensor itself and the force-resistance relationship complicated, not simply linear, which limits its usage in applications.
However, for our design, we do not need to accurate data of egg's weight. It is good enough to provide us with the info about the presence of egg in the egg tray, which is a binary data.
When no pressure is applied to it, it will be at the maximum resistance; as force applied on, the resistance would decrease regarding to the magnitude of the force. This allow us to measure the data by voltage using a voltage divider with a reference
resistor connect with it.
Worth enough to notice, this type of sensor is not that accurate, it could have up to 10% error by the nature of the sensor itself and the force-resistance relationship complicated, not simply linear, which limits its usage in applications.
However, for our design, we do not need to accurate data of egg's weight. It is good enough to provide us with the info about the presence of egg in the egg tray, which is a binary data.
Microcontroller
In our design, we embedded a micro-controller in the 3D-printed egg tray prototype. We chose the PIC18 8-bit micro-controller by Microchips. It has a couple embedded 10-bit analog-to-digital module, I2C two-wire datalink control interface module and a built in clock generator. Most importantly, it could be solely powered by 2 AAA batteries, working at ~3.0V.
How we designed the circuit
As the micro-controller is only powered by batteries, we would like to consume as less energy as possible during the normal data gathering operation. Recall the circuit for pressure sensor is a voltage divider, we need to provide a reference data (which is VDD = 3.0V) to it. Which will result in a constant power drain for the batteries. We made specific test and experiment to decide the way to implement this part. First the is the choice of reference resistance, as voltage divider, we read data through the voltage between the sensor and reference resistor as VDD is provided to another end of the sensor. Which allows us to use the choice of reference resistance to limit the power consumption. On the other hand, the choice of reference resistance influences the accuracy and voltage range of our reading. Take in consideration of the noises existing in background and the energy concerns, after experiments and measurements, we finally chose our reference resistor to be 2.2 MOhm.
For the sake of saving energy, we also decide only to power the voltage divider circuit only if Edison board is requesting data from the micro-controller which would only happen once per minutes. By using the General Purpose Input-output(GPIO) module built in the micro-controller, we made it happen.
For the communication between datauploader - Edison board and the micro-controller, our choice of the protocol is I2C, which is a lazy clocked 2 wire interface that only switch voltage when there is communication going on. As mention the before, the communication would not happen very often.
For the sake of saving energy, we also decide only to power the voltage divider circuit only if Edison board is requesting data from the micro-controller which would only happen once per minutes. By using the General Purpose Input-output(GPIO) module built in the micro-controller, we made it happen.
For the communication between datauploader - Edison board and the micro-controller, our choice of the protocol is I2C, which is a lazy clocked 2 wire interface that only switch voltage when there is communication going on. As mention the before, the communication would not happen very often.
INtel Edison
In this project, we are using Intel Edison board as the initial data processor and data uploader. It's an embedded computer having Linux running on it which allows us to use python to run our data processing program and request the data from micro-controller on a timing basis. By using the embedded WiFi module, Edison communicate with the DynamicDB database service to store the necessary data to the cloud for storage.
Also, the Edison board has the role of take in charge of telling micro-controller in the egg tray when pull the data from the sensor and send it to Edison itself. As Edison is running on Linux and can be remotely access, this made our upgrade of our design to be easy without actually flashing the micro-controller which means we do not have to pull out the micro-controller from the already built circuit.
However, it is worth to mention the limit of Intel Edison. Edison requires much higher voltage to be powered on comparing with AAA batteries. Without hardware implementation I2C module built in the SoC, it can only serve as the Master node in I2C communication using software simulated controller. But it is still suitable for our prototype.
Also, the Edison board has the role of take in charge of telling micro-controller in the egg tray when pull the data from the sensor and send it to Edison itself. As Edison is running on Linux and can be remotely access, this made our upgrade of our design to be easy without actually flashing the micro-controller which means we do not have to pull out the micro-controller from the already built circuit.
However, it is worth to mention the limit of Intel Edison. Edison requires much higher voltage to be powered on comparing with AAA batteries. Without hardware implementation I2C module built in the SoC, it can only serve as the Master node in I2C communication using software simulated controller. But it is still suitable for our prototype.
Data Process
Not all data we requested from the micro-controller is important, comparing to the presence of eggs in egg tray, we care more about the changes happened to the status of eggs (when it was put there, when did it disappear). Considering the fact that people don't really touch egg tray very often, actually, during the user study, we found people only use it for a few times a day. So it's up to the Edison to trim the redundancy of data and push only the necessary data to the database in the cloud.
Also, during the user study, we also found some special cases, for example, sometime people get the an egg from the egg tray and eventually decide not to eat it and put it back. In this case, if we want to track how long the egg has been there, we can't just take the old egg as a new egg in the tray. So we decide to let Edison think a change of presence in the tray is finalized only if the egg that was gone has not been back to the same slot for 10 minutes.
To minimize the data we need to push to the cloud, we only push an entry only if there is a finalized change happened into tray. When pushing the data, the Python program on the Edison board would connect to the DynamicDB and add a database entry containing the current status of the egg and when it was changed for every single slot on the tray.
Also, during the user study, we also found some special cases, for example, sometime people get the an egg from the egg tray and eventually decide not to eat it and put it back. In this case, if we want to track how long the egg has been there, we can't just take the old egg as a new egg in the tray. So we decide to let Edison think a change of presence in the tray is finalized only if the egg that was gone has not been back to the same slot for 10 minutes.
To minimize the data we need to push to the cloud, we only push an entry only if there is a finalized change happened into tray. When pushing the data, the Python program on the Edison board would connect to the DynamicDB and add a database entry containing the current status of the egg and when it was changed for every single slot on the tray.
Data Monitor & REMINDER
In our design, we also had a watchdog for the whole database, handling the job to inform user the necessary reminders. This allow us to remind user to remember to buy new eggs on his way home when the current amount of eggs in the tray is low, or send a reminder to replace some old eggs bought more than ten days ago. The reminder system is implemented using Python, running on the EC2 web server on Amazon Cloud Service. It could send reminder using SMS or email according to user's setting.
Mobile APp
We understand that only having a reminder is not enough, people sometime would forget the how many eggs they had in their trays and might want to check it when they are out for business. So we built a mobile app on iOS that could access the DynamicDB and report the current number of eggs and how long they had been there.
Moreover, we are able to show users their egg consumption history using the data in DynamicDB. In addition, our app can give reminder information about the eggs as well.
Moreover, we are able to show users their egg consumption history using the data in DynamicDB. In addition, our app can give reminder information about the eggs as well.
User DATA analysis
As eggs are one of the biggest supply of our daily diet, for people really cares what they had took in their body, the consumption history could be a very good tool for them to plan their nutrition. Also, it would provide real data for medical personnel like doctors and nutrition advisers.