This would be my first post for my Internet of Things Skull. This project was mentioned on my last post. This time I want to post an overview on how it is made and what better than a over complex diagram.
What a mess to make a few LEDs blink, but it was must certain worth it.
Use Case Flow (with Android phone):
All starts either from an Android app or via a mouse click. Would start with the Android app cause it might be simpler.
1. From an android app the user clicks a "Left" or "Right" button.
2. The Android app do an HTTP Post with a JSON message that says BL for blink left, or BL for blink right.
3. The Post message is received in a Python Flask application hosted on heroku and the message is translated and forwarded to the iot.eclipse.org sever using the mqtt protocol. This message is forwarded by using a simple python script.
4. On the laptop a python script has been triggered before all this started. This skullserver.py is a MQTT client that subscribe to a message to the iot.eclipse.org server. When it receives a Blink Left or Blink Right message it forwards the message via usb Serial to an Arduino UNO.
5. The Arduino is waiting for messages from the serial port. The Arduino do the corresponding blinking task.
Use Case Flow (with the mouse):
1. A python code (onMouseBlink.py) is running with a low level mouse hook waiting for a mouse click. When detecting a left or right mouse click it issues a HTTP Post to the Python Flask application hosted on heroku.
2. Same flow as on the User Case Flow (with Android)
Source Code:
The code for python Flask application hosted on Heroku has not been uploaded to github (it will be soon). But it is a simple Flask Service waiting for a post. It receives a Json message and then issue an MQTT publish message to the host.
This is all for now, I am not int Halloween celebration but love the electronics. Future plan is create a similar project using a no festivity related ornament like a small toy car that I can use all year around. Also I am planning on making it wifi to be able to move it around the office.