In iterative development and exploration process, details will be consolidated once I'm closer to something... "final".
An non-straightforward journey to build a wearable UVI indicator.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
In iterative development and exploration process, details will be consolidated once I'm closer to something... "final".
I finally managed to program an ATtiny85 using the SparkFun Tiny AVR Programmer which I recently received. I initially attempted this with a cheaper programmer and in hindsight, I probably could get it working, I was just not used to the... lack of feedback you get with standard ATmega or the SAMD21 boards. I also tried using an Arduino Uno but I managed to mess up its bootloader in the process, so that'll be a fun project trying to get it back to a normal state.
As mentioned in the previous log - the ATtiny85 is not the only hardware change, with a switch to a smaller OLED screen, GUVA-S12SD sensor, and switching to a button battery rather than a rechargeable LiPo battery. All with the goal of making the final device as small as possible. With that in mind, I've tagged the current codebase at v0.0.1 with (mostly) functioning code for the previous hardware setup, although I'm still not confident about the battery indicator.
I've also saved the test code I used for the smaller display on a separate branch to keep track of the various experiments. It is worth noting that I've also switched to a different breakout of the GUVA-S12SD sensor that aligns with that sold by Adafruit, whereas the one you see in previous logs had a two-stage LM358 op-amp requiring additional calculations, so if you're copying my test code you can comment out the 2nd stage adjustment.
So, with the new hardware I ran a few piece of test code - seeing if I can set up the display (picture above, code here), then I ran some checks to see if I can fit the text on the screen and finally I've managed to hook up the whole circuit, as you can see below.
I'm still figuring out the exact calibration and calculations and right now it's not producing a sensible UV index value, at least not comparing to the previous iterations, so while I'm still experimenting, the code is currently on a separate branch.
The next obvious step is fixing the calculations, and assuming all that works out I'll be investigating putting the ATtiny to sleep and waking it up on demand. Considering there's no built-in capacitive touch like with the Qt Py, this should fun to experiment with.
On a final note, I'm still not 100% sure on the hardware, especially when considering moving this project onto a single, bespoke PCB. The ATtiny85 is still relatively bulky and there is a chance I might go for something close to the Qt Py, e.g. ATSAMD21G18. The GUVA-S12SD sensor also seems to be problematic, in terms of sourcing just the sensor without the breakout board, although desoldering it from the breakout board is also an option. In the end, the main goal is to get from prototyping/breadboard stage to an all-in-one PCB and while it's quite a simple project, it's definitely an interesting journey going through this for the first time.
It's been a while since the last update as I've been busy with some 3D printer tweaks, waiting on parts, rethinking the approach, and other stuff.
After experimenting with battery life calculation and measuring out dimensions, I'm getting closer and closer to the conclusion that I can't shrink things down to the size I want using the Qt Py, the LiPo BFF and a rechargeable battery. Well, it's most likely doable but I'm quite there in terms of my electronics skills to figure everything out just yet.
The current goal of the project is to get everything working using a 3V button battery (CR2032 or CR2025 most likely), an ATTiny 85, the 0.49" OLED screen seen in previous logs and a switching to the GUVA-S12SD UV sensor. With that in mind I've designed a very optimistic and much smaller case, which nothing fits into right now. The goal is to try to get everything to fit in a similar form factor and a single PCB, you can see the preview below:
The case is made from 2 parts with a slide-in back piece:
And as you can see, the size is significantly smaller compared to the previous 5 version of the case:
The fact it's much smaller makes printing a lot faster so I should be able to iterate a lot faster too and a screw-less design makes things easier to assemble too.
So, the next step is trying to program the ATTiny 85 to do the work - it's a new chip for me but I've got everything I need to program it using an Arduino Uno. I'll try to get things working and wired up and fit into case with current component setup - if all goes well I'll be able to show this off in the next log. Until next time!
No new prototype case this time around, I've parked my 3D printer for the time being while I set up OctoPi. :) What I did make progress on though, is some battery magic. Or well, battery experimentation...
The Qt Py Charger BFF outputs the battery voltage (well, half the voltage) on pin A2, so I've been trying to map this to some form of a battery indicator. After some initial testing, I managed to detect charging state and draw a basic battery indicator on the screen, you can see the preview below (I replaced the human-readable UVI value with voltage for the time being).
The only "easy" way of testing the accuracy of the indicator that I could come up with, without additional equipment I don't have, was to set up a time lapse video... Needless to say it ran longer than expected with just under 20 hours of on-time. I didn't want to lose track of the timing so I turned it off and paused the time lapse when I went to sleep. It was a very dodgy setup with an old GoPro resting on a speedcube and video is blurry, but you can see it function:
Overall I was concerned about the linear mapping of voltage to battery level being very inaccurate, however it's not noticeably terrible so I'll likely keep the code as is. I had the "cutoff" when the battery dies set to 3.2V in my code, however it seems like it died just as it dipped below 3.29V, I assume the battery protection circuit shut things off at that point so I might adjust the code with the new cutoff of 3.28, but again - it's not super noticeable. The code is currently on a separate branch as I was doing a lot of experimentation, but you can see it here: https://github.com/ripexz/uvee-py/tree/batt
In other news, I've been experimenting with smaller components - I've found a tiny 0.49" 64x32 OLED screen and hooked it up to a spare Arduino Uno laying around to check if it works and if I can show everything on the screen I want clearly. Overall, I'd say the experiment has been a success:
That's all for this update, looks like it's time to work on that low-power/sleep code that I've been procrastinating on! Although I do have another (analog) UV sensor I'd like to try out... :)
Quick update - v5 enclosure printed and contains everything relatively neatly, the only problem is the battery cable is too short for the battery that fits inside so while it's inside the enclosure, I've attached a separate battery for the time being:
You can see more of the internals below:
As you can see, the sensor is now mounted to the lid (reused from v4 as it didn't change) and the battery takes up a bunch of the space in the lower section. The screw holes in the bottom are in overhanging sections so the battery just slots in underneath.
I need some kapton tape to tidy things up on the fixed-up battery, but overall things are pretty much self-contained now. As mentioned in previous log, I'll be investigating putting the Qt Py to sleep and waking it up using capacitive touch, though I might take a break this weekend. :)
The Qt Py now has a BFF, specifically - the Adafruit Charger BFF for Qt Py.
I've attached a 350mAh battery and the negative cable immediately broke... I attached a larger 500mAh battery while I resoldered the cable and designed a new larger case (v4 now) to accommodate the combined Qt Py and BFF.
It was late in the evening, so of course the screen doesn't fit, I forgot to re-extrude the screw holes and the battery cable is too short (questionable positioning aside)...
The picture above features the larger battery. I've also realised the short-cable version of 350mAh lipo battery is much bigger than the long cable one so I'm investigating alternatives... I've also ordered a smaller OLED screen which should allow making things more compact still, though I lose the Stemma Qt quick prototyping advantage there. On the other hand, the screen and battery are the largest space consumers although the BFF bulks things up too, but if all goes well down the line it can all be put on a single PCB.
Next up - I'm printing v5 of the enclosure though I'm reusing the lid from v4. Since only the BFF has an on/off switch and it'll be hidden, once I have everything in a nice neat package I'll start looking at the putting the Qt Py to sleep... and waking up with interrupts, most likely taking advantage of capacitive touch. And it would be nice to add a battery level/charging indicator as the BFF has a voltage divider connected to pin A2 and I should be able to figure out battery/power state from that.
No major progress since last log, however I've made some tweaks to the code to increase the text size and also show the usual Low/Moderate/High/etc. text on the second line.
I've also uploaded the project code to GitHub, you can find the repository here: https://github.com/ripexz/uvee-py
The code is in an awful state with random glued-together snippets, but hey - so is this whole project!
Up next, I'll be taking it apart again, attaching a battery and charge controller and maybe a few more bits and pieces...
The third version of the prototype case has been printed:
Probably enough 3D printing for now, next up - I'll try to get it battery powered and maybe some code improvements.
The aforementioned v2 that was printing while I wrote the first log entry finished printing (to be fair, it only takes about 1h20m).
I'm slowly enclosing more and more of the project, the fit was much better this time and the Qt Py underneath just neatly slots in rather than rattling around, generally most things "snap-fit" though I need to make the sensor area a little smaller:
I still need to adjust the mounting holes as I've (once again) miscalculated. I'd like to reduce the exposed sensor area and also hide away more of the cabling in v3. After that, it's time to look into connecting a battery.
Finally, here's a short video showing it from all sides:
As I'm writing this, my 2-days-old Ender 3 v2 is printing the second version of an enclosure for the project. A very bulky enclosure for the first prototype.
The first enclosure, or frame really, had a few issues so some very ungraceful adjustments were made with a Dremel, the resulting assembled prototype looks like this (printed in PLA):
Under the hood (if there was one), I have a:
The latter is tucked under the OLED display with USB-C port facing out. As you can see, all of these are currently connected with JST connectors, leveraging STEMMA QT - first time trying this out but seems to work great for quick prototyping.
On the software side, I tried CircuitPython - however it constantly complained about lack of memory, space and everything else so I've switched to the good old trusty Arduino IDE, however the library for the LTR390 sensor definitely needs some love as I had to port some helpers over from the Python lib.
In summary, this is nowhere near a comfortable wearable device and closer to a plug-in smartphone accessory (and an ugly one at that), so there's lots of work ahead!
The next steps? I'm gonna continue iterating on the enclosures for current setup to get confident with CAD/3D modelling again and progress to adding a charging circuit and a battery and see how they can all best fit. And then? Then it's time to tear it all apart again, cause we want to make things smaller. Waaaay smaller.
Create an account to leave a comment. Already have an account? Log In.
Interesting project indded. But it always amazes me the no of times blurry videos are posted ..
didnt U check it first?
It was a late night fire-and-forget situation, it did the job for me, anyway.
Become a member to follow this project and never miss any updates
Fair enuf, been there too.. way past my knock-off time too.
could U please fix the dud link to github?!