Join GitHub today
workshop scope - control methodology #4
interactive control (wireless, via bluetooth from phone?)
Driver is whether we can find/build a bluetooth remote control solution on the phone. As this is not a part of this particular workshop, any tech is fine, as long as it is reliable and usable by both Android and iPhone users.
It seems like a bluetooth wireless controller can be implemented as a phone app in React native. Here are some tutorial links:
And here are a couple libraries that provide a BLE (Bluetooth Low Energy) module in RN:
There are also some webapp options worth exploring. Here are some resources:
I've never used RN nor built a native app, but I'm willing to spend a day or so to spike a proof of concept. That might give us an idea on how deep this
And of course, I'm always open to feedback
I'd definitely be free to review anything you come up with if you think that would be helpful :). My experience with React Native is pretty minimal, but I'll help how I can!
Our alternatives if crossplatform BLE doesn't pan out would be obstacle detection with a sonic sensor. Either way, getting to the point where we're thinking about how to steer our car is a big win, and would still be months down the road.
I spent a day on this, and I got blocked on a few issues in both iOS and Android development. My general takeaway is that without some native-app expertise, this will take a lot more time than I had anticipated
So here are some options that I see moving forward:
I tried following the Expo guide linked in my comment above. I documented some details of my attempt below, in case anyone is interested in exploring or providing feedback.
I created a repo here: https://github.com/modulitos/toycarcontroller where I followed the step-by-step instructions.
I made it to the last step, where I needed to run:
There seems to be an issue with linking the React Native bluetooth module here: modulitos/toycarcontroller@a9e38a7
My intuition here is pretty limited, since this is my first time doing mobile development.
I made it to the last step on the Android app, and the app successfully built after connecting my Android phone and running the command
But it looks like there was still an error in getting the app to run. I suspect this isn't caused by the build, and might be fixed by building out the app logic.
Yowza! Ok, thanks for this, @modulitos. It seems that a simple sensing robot would be a good first step, with an eye on making it remote controllable only if/when a solution presents itself. I'll be at OxidizeConf, and will ask around while I'm there if anyone has any ideas.
Assuming nothing ready-made drops itself in our laps, that would mean the project would be simpler:
There's nothing stopping us from adding remote controllability to the project as a separate step later on if there is interest. WDYT?
@U007D Yes, that sounds like a great path forward
I think starting on the Rust modules will give us some time, and motivation, to figure out the sensory input.
If we're lucky, the Expo team will ship Bluetooth support by the time we are ready to make that decision
Note: this was originally posted in our chat
Below is a proof of concept to demonstrate how a static website using Web Bluetooth can connect with a BLE device.
Here are steps to repro the proof of concept:
Download the "BLE peripheral simulator" app on Google Play (sorry, I didn't explore an iphone option):
This app allows us to test the Web Bluetooth without needing a BLE Peripheral Device. Note that our car will eventually be the BLE device that is simulated by the app ;)
Once the app is downloaded, open the app on your phone.
Then on a separate machine, visit this website using Google Chrome:
Click the "Get ❤" button in the center of the web page. A pop up will appear, scanning for BLE devices, and your phone should appear. Click on your phone to pair with it.
Within the phone app, click "Heart Rate Monitor", change the "Heart Rate" number to any number you'd like (eg: 42), and click "notify".
The web page should display the number 42
As for next steps, I think a reasonable MVP is to control an LED that is mounted to our RISC board over Web Bluetooth.
There is a repo of web bluetooth demos here:
I'm going to explore this demo, which is for a controlling LED's over web bluetooth:
I'll also need to read up on the GATT api, which is the protocol used by Web Bluetooth:
I'll also need to start reading up on the Rust embedded discovery book, because I have no idea how to integrate BLE and LED devices onto a RISC board.