How we built the Floud
To enable communication over the internet, we needed to create a centralized server. There are many options available but AWS offers in my honest opinion the best value. They provided us with $1300 startup credit for running our servers which should allow us to run them for at least 2 years. Every startup younger than 3 years is eligible for such benefit.
I wanted to build fast and reliably. For that, I choose Typescript and NodeJS. AWS has great support for that combo. I am using the Elastic Beanstalk service to provision a NodeJS server that is running on a dedicated EC2 machine. All I had to do is to set up an Elastic Beanstalk environment. Deployment is dead simple as well. When using the AWS CodeCommit you can simply run eb deploy command every time you want to deploy a new version. This allowed me to focus on functionality rather than infrastructure. Which is so great!
On the server-side, there is a socket server running and accepting connections from all the Floowers out there. The other server is responsible for providing REST API to control the Floower from mobile or web app. This architecture is great because as the number of Floowers connecting will grow all I need to do is just spin more socket servers to maintain more connections.
How does the Floower communicate?
Every Floower is packed with a powerful ESP-32 microcontroller with WiFi and Bluetooth connectivity. All you need to do is just enable it by upgrading our firmware to the latest version (Flooware 10). Once the Floower is connected to your home WiFi network it will automatically connect to the socket server. And the connection is kept alive as long as Floower is connected to the internet. The only drawback is that Floower needs to be connected to the power supply all the time. WiFi is power-hungry.
I’ve designed a Command Protocol for commanding your Floower. For example, when you change the color it will send the ChangeColor command with a color payload to the server. The server checks if you are eligible to command specified Floower and then forwards the command to the opened socket connection. Floower parses the command and handles it accordingly while sending an acknowledgment back.
Everything around the Floower firmware is open-source. So feel free to have a look.
I choose Flutter as our mobile framework. Developed by Google, based on Dart programming language. Flutter is a powerful mobile framework that enables me to build cross-platform apps for either iOS or Android. The fast and native-like development was a key factor for me.
When the app is installed and running it will try to maintain Bluetooth connectivity when near your Floower. As soon as you are far away it will leverage the Floud to communicate and command your Floower over the internet. The mobile experience is not yet ideal and we are working toward making it so much better!
Nobody is allowed to control your Floower. When your Floower is first connected to the Floud it will automatically obtain an identity key. With this identity key, the Floower authenticates against the socket server. This key cannot be read back from the Floower or server.
Your mobile app will do the same. The server is responsible for pairing these two identity keys making sure nobody else can command your Floower without knowing its identity key.
At the same time, no sensitive information is being stored on the server-side. We are only storing the last state of your Floower to be able to restore the mobile app.
This is so huge
So far we did not uncover the full potential of Floud. Imagine you would be able to control your Floower based on particular events – like time, weather, anniversaries, and your other significant events. The server will do the job for you. I am working on a Zapier and IFTTT integration so you can integrate with your smart home and much much more.
Thanks for reading. Stay tuned!