-
Apology for no updates, project still important to me
11/19/2024 at 17:02 • 0 commentsJust wanted to add an apology for no updates for a few weeks. As many people would know, having a side project can sometimes take a back seat to other life events, and such is the case this time. However, this project is still on my mental to-do list, so no worries there.
The last work I did on the project successfully transmitted the phone's time to the watch, so there's been progress. I just likely haven't wrapped it up in a nice bow and published it.
-
Short update, new display working
10/10/2024 at 02:24 • 0 commentsI got the new ST7789 display with the microSD drive working! It was roughly the same code as the SSD1327 with the same pin assignments, including setting -1 for the reset pin.
https://www.adafruit.com/product/3787
One odd bit was that the display has much more resolution than the previous one. Since my display shows up on 1/4 of the screen, I'd say the resolution is 4 times as dense, but I could be wrong.
It's been slow making progress, mostly since I have other side projects that I am pursuing, but I did at least migrate over to the new display. This sets up using the microSD for memory storage later.
One tricky bit will be keeping time going with the watch while not connected.
My first thought was "OK, we need a small battery to keep the time ticking", but perhaps we can use a very small bit of power from a battery to keep things running, even if the watch itself doesn't have enough battery power to run.
Lots of stuff to do, but should be fairly simple to do each one.
-
Current work directions
09/30/2024 at 16:58 • 0 commentsCurrent tasks
- merge code between versions 01 and 02 so that it responds like 01 did, but to my phone app instead of the Adafruit app
- change to this screen, which doesn't have the stemma connector, but does have a microSD slot, which the smart watch can use for memory (like remembering time): https://www.adafruit.com/product/3787
- send the phone's current time to the smart watch
- smart watch receives updated time and sets watch to that time
- store watch state on microsd at a semi-quick interval (1-5 seconds)
- watch pulls state from microsd and sets values from that state when watch starts up
- full test
- power up watch
- connect via bt
- phone sets time on watch
- power down watch
- power on watch, watch remembers time
- connect via bt
- phone sets time on watch
Future tasks
- need battery-only bt-only path in code
- example: keeping time apart from phone
Side note: I tend to think in lists like this, probably from my programming background, but it works well when presenting information in an easy-to-organize way
-
Finally sent data to the device!
09/24/2024 at 04:58 • 0 commentsIt took a ludicrously long time to finally get to a consensus between my device and my React Native app, but I finally sent meaningful data from the app to the device and it was received correctly.
On the device, I used the BLEDevice library among other things, and utilized the Arduino example for BLE -> Write.
However, I was left with an issue: how exactly do I send data over to the device from an app? I wanted to stay in React Native if possible.
The react-native-ble-plx library was what I was using, and I managed to get to the point where it was the Profile.Service.Characteristic I had to write to. But that still left the matter of how to package the data and send it.
const sendData = (str) => { // THIS IS THE MAGIC SAUCE THAT ENABLES A STRING TO BE SENT TO ARDUINO ESP32 WITH BLE USING BLEDEVICE LIBRARY const myBuffer = Buffer.from(str).toString("base64"); connectedDevice .writeCharacteristicWithResponseForService( SERVICE_UUID, CHARACTERISTIC_UUID, myBuffer, ) .catch((e) => { console.log("Failed to sendData", JSON.stringify(e)); }); };
As you can see, the code to write to the characteristic was fairly boilerplate, but I didn't know how to send the string to the device so that it would come out decipherable on the other end.
After an agonizing 12 hours or so of research and trial and error, I went from "Buffer.from(str)" to "Buffer.from(str).toString("base64"), and it went over cleanly.
There is a bit of a glitch where if the device doesn't initialize properly, it will throw an error on the app side, but after resetting, it seemed to work without issue.
Here are the repositories for the app and the watch. It's mostly copy and paste code anyway, so I certainly don't mind sharing.
I will need to update my objectives, but this was a huge blocker that I finally managed to clear.
I hate to make it sound more grandiose than it is, but imagine first being able to send data over a network, before the Internet. It kinda felt like that.
-
Shifting development to ESP32 board
09/14/2024 at 05:38 • 0 commentsI've had a LOT of difficulty bridging the gap between React Native BLE PLX library and the NRF52840 board in terms of sending data from a phone app to the board.
After a bunch of looking around, it looks like I'll have more luck finding examples for an ESP32 based board, such as this awesome writeup: https://www.cjoshmartin.com/blog/bluetooth-low-energy-ble-with-react-native-and-arduino
I'm going to try to set up a "characteristic" that I can then "write" to so that I can send a packet of information to the device.
And while I'm not sure, it looks like the timer I had running on it previously with no issues stops after 2 seconds on the Adafruit ESP32-S3 board.
I will update when I have news!
-
Progress made in companion app
09/06/2024 at 13:56 • 0 commentsI've made some progress on the companion app thanks to this nice tutorial from expo that I've linked before: https://expo.dev/blog/how-to-build-a-bluetooth-low-energy-powered-expo-app
It provides not only the finished code for the tutorial, but some started code to follow along as well.
Strictly speaking (not sure if that's the right phrase), this tutorial is very similar to what I'm trying to accomplish with this project: a way for people to start with an idea for a Bluetooth smart device that connects to a phone app.
I also added an objective for myself to receive data from the watch. In terms of an open source project someone can pick up and run with, this would be a good thing to have available as a starting point.
-
Quick Update: Back to Expo and React Native
08/31/2024 at 15:37 • 0 commentsI am back to using Expo and React Native, for three reasons: 1) Expo is an easier way for me to generate apps for both Android and iOS, 2) I'm familiar with React and React Native, and 3) I actually got an app to work, and there may be hope yet.
I had success getting a sample project to work with this post: https://blog.theodo.com/2023/07/ble-integration-for-rn-apps/
Long story short, I did not use EAS to make a package then use on my phone, I used USB debugging. It didn't QUITE do what I wanted, but 1) it didn't crash and 2) once I manually turned on bluetooth on my phone, it popped up the bluetooth selection menu. I also had to use Node 16 due to this setup using an outdated SSL setup.
I also found this blog post on the Expo web site I'm going to try to get working: https://expo.dev/blog/how-to-build-a-bluetooth-low-energy-powered-expo-app
The main goal is to make an Android app (for now) that connects via bluetooth to my homemade smart watch.
-
Update, trying a native Android app
08/25/2024 at 03:23 • 0 commentsI had trouble getting a Bluetooth app to work with Expo going to Android, so I'm going to try making a native Android app. I figure it doesn't matter if I submit the app, so I don't need Expo's system to do that.
The main point is to make an app people can download and use, even if they have to build it and install it themselves.
-
Project objective progress
08/13/2024 at 16:17 • 0 commentsTo give an idea of what I'm trying to accomplish with this project, here are the epics I have thus far, and their completion rates
watch responds to bluetooth 100% create and publicize code respository
(both arduino and react native app)100% make a simple bluetooth app in react native
that watch responds to (all mock data)25% functioning physical watch buttons 20% send time to watch via bluetooth 0% send display to watch via bluetooth 0% receive data coming from watch 0% full test of watch functionality 0% compartmentalize watch code for easy
add/removal of functions0% code cleanup and possible unit tests 0% PROJECT COMPLETE -
Success connecting to Adafruit app
08/13/2024 at 05:12 • 0 commentsShort update, I successfully copied some older Arduino code to connect the Feather board to the Adafruit bluetooth app, and the buttons on the controller (1 through 4) come through just fine, so it has basic bluetooth connectivity working.
I wanted to post a picture of it, but since the display wipes after the button is released AND I am holding the phone taking pictures, not doable.
The next challenge has two main parts
- Make a basic phone app with the ability to connect to the board
- Have that app send data that can be read by the board and acted on. For initial proof of concept, I will try to have it send the same data that the Adafruit app is sending, with a stream of "B4949" for "button 1 pressed", "B4948" for "button 1 released" and so on.
Note the use of ascii numbers for both the number of the button and the status of the button, with 48 being zero and 49 being one.
To some people reading this, this is very basic stuff, but it's a learning experience for me, and possibly for other people reading this very post.