Develop a product that involves an embedded system for the embedded system application lab. That was the task at hand for the embedded system application lab during the course of MTech. A product…Hmm… We were a team of three, when we had to handle the task along with our internship. Things went through our minds on several topics and the main concern was whether we could manage to complete it on time. Well then we decided to take the risk and proceeded with that topic. sCycle. The idea was to develop a module which could convert any bicycle into a smart cycle with a phone application as it's console.
The initial specification list was huge. The module, which can lock or unlock the cycle based on commands from the app, which can measure the speeds, detect accidents etc. But time was less and we cut down our specification list to just lock/unlock, realtime speed and distance measurement and a demo calory measurement. I mentioned demo as it's not the actual calculation and we wanted to bring out the possibility of implementing that functionality.
We wanted to bring something cool into the project. So the idea was to create an android accessory, where you just plug in the the phone to the "dock" (which is essentially a connection via the micro-usb port) and the app opens automatically. Thus we wanted something with usb capability at the cycle side and the easiest choice was a raspberry pi. Now that we got our system's brain, we wanted something to measure the distance covered and the speed of the ride. And the simplest choice was using a reed switch and small piece of magnet that my friend took from his old speakers.
Now that we've got all our components, let's move on to the implementation. Aravind took charge of the raspberry Pi side which would run a python script on booting up that will count the number of triggers from the reed switch and send it to the connected phone. It also exchanges the USB data on connecting the phone, which will open the app associated with the corresponding USB data. This time, I tried to step up my app development knowledge, by developing the app using android studio. Using Cordova and web app as in eCampus was not an option since we needed the android USB accessory API, that was not supported by Cordova. We gave a simple design to the app, which starts once connected to the pi on the cycle, which directly goes to the ride mode, shows the time, real time speed, distance covered and a button to stop the ride mode. Once ride is stopped, the user is given a summary page which shows the ride details.
The lock/unlock was indicated using a LED, with the concept, that the cycle will be unlocked on docking the phone, and the app will be initiated by pressing a button on the handle. The source code of the project can be found here.