During my sophomore year, a senior of mine approached me with an issue of connecting hardware(i.e. Arduino) to software by using simple,existing libraries and framework. This would receive data from hardware, store in a database so that either a mobile app or website could fetch and display it, all of it in real-time meaning less latency and more efficiency. So, this post is basically the solution of the above issue, by using
So lets begin by first sketching out our architecture upon which our system shall be created.
Note:-I shall not cover the hardware part because that is not our main focus
Architecture for our System
According to our architecture, if we take an example of an simple sensor whose output needs to be processed real-time in an Mobile App then these are the following steps:-
So now lets create a simple heartbeat display mobile app by following the above architecture norms, also adding features such as,displays the heartbeat(in beats per minute), animation and graph plotting in real-time.
The Java version of the mobile app is already made(below is the rep.)
S2606/HeartBeat_HeartBeat - 💚 An Android app which on giving value of Beats per Minute(BPM) would show hearbeating animation as per…_github.com
Lets move a step ahead and make the same android app in KOTLIN!!
First we shall cover the API part. I am assuming you know how to create a new project in Firebase and find the config. keys for the Web. If you dont know I request you first have a clear look of how Firebase works. I am sure you shall find suitable article in Medium.
Moving on, after finding them the following Nodejs code(server.js) for RESTful API:-
remember to host this to any cloud or web hosting service like heroku or digital ocean etc(I would recommend Heroku) so that it can be accessible.
Now its time to make our hands dirty with KOTLIN!!
I shall not explain why is kotlin good blah blah blah… we already have tons of article for that rather after gaining some basic insight lets just code it.
2. My personal favourite(being a lazy programmar) the data class (makes getter-setter so small)
3. MainActivity.kt last but not the least(crux of the app)
We did it!!
we have succeeded in implementing our focused part of model by creating
I hope this article was useful. Please like, share, leave a response regarding anything about this project.
P.S:-This was my first medium article.Hope i haven’t disappoint you.I am a self-learned,passionate programmer who wants to create stuff which have never been heard,seen or thought of. You can see my other projects at https://github.com/S2606, LinkedIn:- https://www.linkedin.com/in/shagun-khemka-b55843118/