SlideShare a Scribd company logo
HOW TO USE OPENDATA, FIREFOX
OS AND A RASPBERRY PI TO BUILD A
BETTER WASHING MACHINE
André Fiedler
mozillians.org/en-US/u/SunboX
2015-04-06
Why a better washing machine?
First, I wanted to learn a bit more about the current state of OpenData in Germany.
Second, I wanted to check out Firefox OS (FxOS) on Raspberry Pi (RPi) and running a
web server in pure JavaScript.
And last, current washing machines suck and are very inefficient.
2/27#FirefoxOSAndIoT
How current washing works.
Washing machines have to clean your laundry.
If it’s dirty after washing no one would ever buy this machine again.
To achieve this, washing machines
…and they don’t inform you when they did finish.
consume too much water
consume too much energy / time
consume too much detergent
·
·
·
3/27#FirefoxOSAndIoT
Why do they use too much of all?
(most) machines don’t know the weight of your laundry
they don’t know the water hardness
they don’t know the type of detergent to use
detergent manufacturer trick you to overdose their detergents
·
·
·
·
4/27#FirefoxOSAndIoT
How to fix this?
using more data — OpenData
smarter washing machines — Internet of Things (IoT)
·
·
5/27#FirefoxOSAndIoT
Internet of Things?
Smarter washing machines that automatically dose the detergent and water by using
OpenData and at the end using less energy.
Smarter washing machines that provide data, like used energy, used water, washing
time and all kind of stats so someone else could build up on this.
6/27#FirefoxOSAndIoT
Using more data
Measuring the weight is easy, but how about the water hardness and used
detergent?
7/27#FirefoxOSAndIoT
OpenData to the rescue
Since February 2014 there’s a initiative called „Code for Germany“
http://codefor.de
Volunteers work together with german city councils to digitalize open data and make
it easy accessible to everyone. A good example is the Open Data Lab Heilbronn. They
put all their data on Github here https://github.com/opendata-heilbronn
8/27#FirefoxOSAndIoT
I used their water data for my washing machine sample,
by providing it through an API:
https://github.com/SunboX/fxos-washing-machine_water-api
This simple example shows how much OpenData can be used to make things better.
Even if the people who opened this data to the public didn’t really know what it can
be used for. All cities have collected data about your water quality (and much more)
— very few make it open. So „Code for Germany“ is really necessary to make all the
public data accessible to everyone.
9/27#FirefoxOSAndIoT
Ok, now we know the hardness of our water. But how
about the detergents?
Same thing here, make it public available. Every detergent manufacturer prints it on
the packaging. But by now there’s no database containing this data.
Who want’s to build a website for collecting it? I’ve already a proposal how the API
could look like: https://gist.github.com/SunboX/d688d76ff6ca7b1a2f24
10/27#FirefoxOSAndIoT
So now we have enough data to work with,
the really cool thing …
11/27#FirefoxOSAndIoT
FIREFOX OS RUNNING ON A
RASPBERRY PI
12/27#FirefoxOSAndIoT
Firefox OS running on a Raspberry Pi
Firefox OS is great for rapid prototyping. It’s as easy as writing a web page.
There’s a wiki page about the current state of FxOS on RPi and some info about how
to flash it onto your RPi: https://wiki.mozilla.org/Fxos_on_RaspberryPi
I’ve used a special build by Jan Jongboom who is currently working on improved
GPIO support. You can download this build from here:
https://gist.github.com/janjongboom/94d575526a689687a6b8
13/27#FirefoxOSAndIoT
How does it work?
I’m running a stripped down version of FxOS called JanOS: http://janos.io/
It’s basically your RPi booting into a HTML page rendered by Gecko (FxOS).
14/27#FirefoxOSAndIoT
The washing machine interface is all build using web technology. It’s controlled by
an app running on a FxOS phone. The washing machine is providing a REST API
allowing the phone to talk to it. This REST API is running on a web server
implemented in pure JavaScript.
15/27#FirefoxOSAndIoT
Lets go into detail of this …
16/27#FirefoxOSAndIoT
The washing machine interface
You can find the source code for the interface at:
https://github.com/SunboX/fxos-washing-machine_interface
17/27#FirefoxOSAndIoT
After the RPi did boot up it tries to automatically connect to wifi (which is pre-
defined by now) and than it fires up the web server. The server implementation is
based on https://hacks.mozilla.org/2015/02/embedding-an-http-web-server-in-
firefox-os/
wm.WashingApi=(function(){
letwifiManager=navigator.mozWifiManager,
lastIp,
httpServer,
letinit=function(){
if('onconnectioninfoupdate'inwifiManager){
wifiManager.onconnectioninfoupdate=e=>{
if(e.ipAddress&&lastIp!==e.ipAddress){
httpServer=newHTTPServer(wm.Config.ApiServerPort);
18/27#FirefoxOSAndIoT
The server provides a simple JSON REST API which is used to tell the washing
machine about water hardness and detergents, to start/stop the machine and for
getting stats.
httpServer.addEventListener('request',e=>{
e.response.headers['Content-Type']='application/json;charset=utf-8';
switch(e.request.path){
case'/start':
body=JSON.stringify({
success:wm.WashingProgram.start()
});
break;
case'/data/water-hardness':
letprogramUuid=e.request.params.programUuid;
letwaterHardness=e.request.params.waterHardness;
body=JSON.stringify({
success:wm.WashingProgram.setWaterHardness(programUuid,waterHardness)
});
break;
19/27#FirefoxOSAndIoT
If all data is collected and the start command was requested, the washing program
will be calculated and it starts a timer. Also a LED connected to the GPIO pins of the
RPi begins to blink.
If this were a real machine, it should first automatically dose the detergents based
on the given data and after that start to run through the washing program.
20/27#FirefoxOSAndIoT
How to blink the LED?
… because blinking LED's is cool. ;o)
navigator.gpio.setPinMode(3,'output').then(pin3=>{
pin3.writeDigital(0);
letblinkValue=0;
letblink=()=>{
blinkValue^=1;
pin3.writeDigital(blinkValue);
setTimeout(blink,500);
}
wm.WashingProgram.addEventListener('start',e=>{
blink();
});
21/27#FirefoxOSAndIoT
Next the app …
22/27#FirefoxOSAndIoT
The washing machine app
You can find the source code for the app at:
https://github.com/SunboX/fxos-washing-machine_app
The app will provide some open data like water hardness (after getting the current
location) and washing powder dosis to the washing machine.
23/27#FirefoxOSAndIoT
So, what's next?
24/27#FirefoxOSAndIoT
What's next?
There are three points which can be worked on next:
Finishing the software — Interface & App
The hardware — using real Sensors, maybe a real Washing Machine?
OpenData webpage & API for collecton washing detergent dosis
·
·
·
25/27#FirefoxOSAndIoT
Want to help?
I'm looking for someone interested to help, or taking over the whole project if it fits
to him better.
I'm interested in a lot of things and this small „project“ was just meant to get me
updated about current state of OpenData, IoT and FxOS on RPi.
So if you want to get this further, plz help me or take it. :o) Otherwise I will (maybe)
work on it from time to time.
26/27#FirefoxOSAndIoT
<Thank You!>
contact: andre.fiedler@me.com
twitter @sonnenkiste
github github.com/SunboX
linkedin linkedin.com/profile/view?id=226588234
g+ plus.google.com/116509237159086833815

More Related Content

PDF
M'appare prato (anche in cinese)
PDF
開放資料(Open Data)、 自願性地理資訊(VGI)、 開放街圖(OSM)
PPTX
Meeting presentationV2.pptx
PDF
Raspberry pi: Proyectos de robótica raspberry pi de richard grimmett.
PDF
Hacking with the Raspberry Pi and Windows 10 IoT Core
PDF
IoT Session Thomas More
PDF
Cc internet of things @ Thomas More
M'appare prato (anche in cinese)
開放資料(Open Data)、 自願性地理資訊(VGI)、 開放街圖(OSM)
Meeting presentationV2.pptx
Raspberry pi: Proyectos de robótica raspberry pi de richard grimmett.
Hacking with the Raspberry Pi and Windows 10 IoT Core
IoT Session Thomas More
Cc internet of things @ Thomas More

Similar to How to use OpenData, Firefox OS and a Raspberry Pi to build a better Washing Machine (20)

PDF
Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
PDF
IJSRED-V2I2P36
PDF
Raspberry Pi By Example 1st Edition Pajankar Ashwin Kakkar Arush
DOC
Gerardo Carmona Embedded Engineer
PDF
Raspberry pi: Conceptos básicos de la arquitectura de la computadora raspberr...
PDF
Chapter-7.pdf
PDF
Chapter-7_raspberryPi.pdf
PPTX
[University] Capstone Design Project 2 (SAIOT)
PDF
IoT Based Water Level Monitoring System with an Android Application
PDF
Chapter 7
PDF
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
PDF
Arduino: interruptor de encendido controlado por Internet
PPTX
IoT Workshop Nashville
PDF
IoT-based Autonomously Driven Vehicle by using Machine Learning & Image Proce...
PDF
THE Official RASPBERRY PI PROJECTS BOOK
PDF
Libro de proyectos de Raspberry Pi
PDF
IRJET- Raspberry Pi Baesd Automated Waste Segregation System
PPTX
IoT fun with Raspberry Pi and .NET
PPTX
chapter-7_ed.pptx
PDF
IRJET- Cloth Matching and Color Selection using Intelligent Robotic System
Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
IJSRED-V2I2P36
Raspberry Pi By Example 1st Edition Pajankar Ashwin Kakkar Arush
Gerardo Carmona Embedded Engineer
Raspberry pi: Conceptos básicos de la arquitectura de la computadora raspberr...
Chapter-7.pdf
Chapter-7_raspberryPi.pdf
[University] Capstone Design Project 2 (SAIOT)
IoT Based Water Level Monitoring System with an Android Application
Chapter 7
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Arduino: interruptor de encendido controlado por Internet
IoT Workshop Nashville
IoT-based Autonomously Driven Vehicle by using Machine Learning & Image Proce...
THE Official RASPBERRY PI PROJECTS BOOK
Libro de proyectos de Raspberry Pi
IRJET- Raspberry Pi Baesd Automated Waste Segregation System
IoT fun with Raspberry Pi and .NET
chapter-7_ed.pptx
IRJET- Cloth Matching and Color Selection using Intelligent Robotic System
Ad

Recently uploaded (20)

PPTX
Module_4_Updated_Presentation CORRUPTION AND GRAFT IN THE PHILIPPINES.pptx
PPTX
ANICK 6 BIRTHDAY....................................................
PPTX
AcademyNaturalLanguageProcessing-EN-ILT-M02-Introduction.pptx
PPTX
Anesthesia and it's stage with mnemonic and images
PPTX
Impressionism_PostImpressionism_Presentation.pptx
PPTX
Phylogeny and disease transmission of Dipteran Fly (ppt).pptx
PPTX
An Unlikely Response 08 10 2025.pptx
PPTX
Human Mind & its character Characteristics
DOCX
"Project Management: Ultimate Guide to Tools, Techniques, and Strategies (2025)"
PDF
natwest.pdf company description and business model
PDF
Tunisia's Founding Father(s) Pitch-Deck 2022.pdf
DOC
LSTM毕业证学历认证,利物浦大学毕业证学历认证怎么认证
PDF
6.-propertise of noble gases, uses and isolation in noble gases
PPTX
ART-APP-REPORT-FINctrwxsg f fuy L-na.pptx
PDF
MODULE 3 BASIC SECURITY DUTIES AND ROLES.pdf
PPTX
Intro to ISO 9001 2015.pptx wareness raising
PDF
COLEAD A2F approach and Theory of Change
PDF
Module 7 guard mounting of security pers
PDF
Microsoft-365-Administrator-s-Guide_.pdf
PPTX
Hydrogel Based delivery Cancer Treatment
Module_4_Updated_Presentation CORRUPTION AND GRAFT IN THE PHILIPPINES.pptx
ANICK 6 BIRTHDAY....................................................
AcademyNaturalLanguageProcessing-EN-ILT-M02-Introduction.pptx
Anesthesia and it's stage with mnemonic and images
Impressionism_PostImpressionism_Presentation.pptx
Phylogeny and disease transmission of Dipteran Fly (ppt).pptx
An Unlikely Response 08 10 2025.pptx
Human Mind & its character Characteristics
"Project Management: Ultimate Guide to Tools, Techniques, and Strategies (2025)"
natwest.pdf company description and business model
Tunisia's Founding Father(s) Pitch-Deck 2022.pdf
LSTM毕业证学历认证,利物浦大学毕业证学历认证怎么认证
6.-propertise of noble gases, uses and isolation in noble gases
ART-APP-REPORT-FINctrwxsg f fuy L-na.pptx
MODULE 3 BASIC SECURITY DUTIES AND ROLES.pdf
Intro to ISO 9001 2015.pptx wareness raising
COLEAD A2F approach and Theory of Change
Module 7 guard mounting of security pers
Microsoft-365-Administrator-s-Guide_.pdf
Hydrogel Based delivery Cancer Treatment
Ad

How to use OpenData, Firefox OS and a Raspberry Pi to build a better Washing Machine

  • 1. HOW TO USE OPENDATA, FIREFOX OS AND A RASPBERRY PI TO BUILD A BETTER WASHING MACHINE André Fiedler mozillians.org/en-US/u/SunboX 2015-04-06
  • 2. Why a better washing machine? First, I wanted to learn a bit more about the current state of OpenData in Germany. Second, I wanted to check out Firefox OS (FxOS) on Raspberry Pi (RPi) and running a web server in pure JavaScript. And last, current washing machines suck and are very inefficient. 2/27#FirefoxOSAndIoT
  • 3. How current washing works. Washing machines have to clean your laundry. If it’s dirty after washing no one would ever buy this machine again. To achieve this, washing machines …and they don’t inform you when they did finish. consume too much water consume too much energy / time consume too much detergent · · · 3/27#FirefoxOSAndIoT
  • 4. Why do they use too much of all? (most) machines don’t know the weight of your laundry they don’t know the water hardness they don’t know the type of detergent to use detergent manufacturer trick you to overdose their detergents · · · · 4/27#FirefoxOSAndIoT
  • 5. How to fix this? using more data — OpenData smarter washing machines — Internet of Things (IoT) · · 5/27#FirefoxOSAndIoT
  • 6. Internet of Things? Smarter washing machines that automatically dose the detergent and water by using OpenData and at the end using less energy. Smarter washing machines that provide data, like used energy, used water, washing time and all kind of stats so someone else could build up on this. 6/27#FirefoxOSAndIoT
  • 7. Using more data Measuring the weight is easy, but how about the water hardness and used detergent? 7/27#FirefoxOSAndIoT
  • 8. OpenData to the rescue Since February 2014 there’s a initiative called „Code for Germany“ http://codefor.de Volunteers work together with german city councils to digitalize open data and make it easy accessible to everyone. A good example is the Open Data Lab Heilbronn. They put all their data on Github here https://github.com/opendata-heilbronn 8/27#FirefoxOSAndIoT
  • 9. I used their water data for my washing machine sample, by providing it through an API: https://github.com/SunboX/fxos-washing-machine_water-api This simple example shows how much OpenData can be used to make things better. Even if the people who opened this data to the public didn’t really know what it can be used for. All cities have collected data about your water quality (and much more) — very few make it open. So „Code for Germany“ is really necessary to make all the public data accessible to everyone. 9/27#FirefoxOSAndIoT
  • 10. Ok, now we know the hardness of our water. But how about the detergents? Same thing here, make it public available. Every detergent manufacturer prints it on the packaging. But by now there’s no database containing this data. Who want’s to build a website for collecting it? I’ve already a proposal how the API could look like: https://gist.github.com/SunboX/d688d76ff6ca7b1a2f24 10/27#FirefoxOSAndIoT
  • 11. So now we have enough data to work with, the really cool thing … 11/27#FirefoxOSAndIoT
  • 12. FIREFOX OS RUNNING ON A RASPBERRY PI 12/27#FirefoxOSAndIoT
  • 13. Firefox OS running on a Raspberry Pi Firefox OS is great for rapid prototyping. It’s as easy as writing a web page. There’s a wiki page about the current state of FxOS on RPi and some info about how to flash it onto your RPi: https://wiki.mozilla.org/Fxos_on_RaspberryPi I’ve used a special build by Jan Jongboom who is currently working on improved GPIO support. You can download this build from here: https://gist.github.com/janjongboom/94d575526a689687a6b8 13/27#FirefoxOSAndIoT
  • 14. How does it work? I’m running a stripped down version of FxOS called JanOS: http://janos.io/ It’s basically your RPi booting into a HTML page rendered by Gecko (FxOS). 14/27#FirefoxOSAndIoT
  • 15. The washing machine interface is all build using web technology. It’s controlled by an app running on a FxOS phone. The washing machine is providing a REST API allowing the phone to talk to it. This REST API is running on a web server implemented in pure JavaScript. 15/27#FirefoxOSAndIoT
  • 16. Lets go into detail of this … 16/27#FirefoxOSAndIoT
  • 17. The washing machine interface You can find the source code for the interface at: https://github.com/SunboX/fxos-washing-machine_interface 17/27#FirefoxOSAndIoT
  • 18. After the RPi did boot up it tries to automatically connect to wifi (which is pre- defined by now) and than it fires up the web server. The server implementation is based on https://hacks.mozilla.org/2015/02/embedding-an-http-web-server-in- firefox-os/ wm.WashingApi=(function(){ letwifiManager=navigator.mozWifiManager, lastIp, httpServer, letinit=function(){ if('onconnectioninfoupdate'inwifiManager){ wifiManager.onconnectioninfoupdate=e=>{ if(e.ipAddress&&lastIp!==e.ipAddress){ httpServer=newHTTPServer(wm.Config.ApiServerPort); 18/27#FirefoxOSAndIoT
  • 19. The server provides a simple JSON REST API which is used to tell the washing machine about water hardness and detergents, to start/stop the machine and for getting stats. httpServer.addEventListener('request',e=>{ e.response.headers['Content-Type']='application/json;charset=utf-8'; switch(e.request.path){ case'/start': body=JSON.stringify({ success:wm.WashingProgram.start() }); break; case'/data/water-hardness': letprogramUuid=e.request.params.programUuid; letwaterHardness=e.request.params.waterHardness; body=JSON.stringify({ success:wm.WashingProgram.setWaterHardness(programUuid,waterHardness) }); break; 19/27#FirefoxOSAndIoT
  • 20. If all data is collected and the start command was requested, the washing program will be calculated and it starts a timer. Also a LED connected to the GPIO pins of the RPi begins to blink. If this were a real machine, it should first automatically dose the detergents based on the given data and after that start to run through the washing program. 20/27#FirefoxOSAndIoT
  • 21. How to blink the LED? … because blinking LED's is cool. ;o) navigator.gpio.setPinMode(3,'output').then(pin3=>{ pin3.writeDigital(0); letblinkValue=0; letblink=()=>{ blinkValue^=1; pin3.writeDigital(blinkValue); setTimeout(blink,500); } wm.WashingProgram.addEventListener('start',e=>{ blink(); }); 21/27#FirefoxOSAndIoT
  • 22. Next the app … 22/27#FirefoxOSAndIoT
  • 23. The washing machine app You can find the source code for the app at: https://github.com/SunboX/fxos-washing-machine_app The app will provide some open data like water hardness (after getting the current location) and washing powder dosis to the washing machine. 23/27#FirefoxOSAndIoT
  • 25. What's next? There are three points which can be worked on next: Finishing the software — Interface & App The hardware — using real Sensors, maybe a real Washing Machine? OpenData webpage & API for collecton washing detergent dosis · · · 25/27#FirefoxOSAndIoT
  • 26. Want to help? I'm looking for someone interested to help, or taking over the whole project if it fits to him better. I'm interested in a lot of things and this small „project“ was just meant to get me updated about current state of OpenData, IoT and FxOS on RPi. So if you want to get this further, plz help me or take it. :o) Otherwise I will (maybe) work on it from time to time. 26/27#FirefoxOSAndIoT
  • 27. <Thank You!> contact: andre.fiedler@me.com twitter @sonnenkiste github github.com/SunboX linkedin linkedin.com/profile/view?id=226588234 g+ plus.google.com/116509237159086833815