Adding the necessary to the extremely economical illumination
Sensible defaults for the image conversion
x-sh - 80.00 bytes - 01/05/2018 at 19:58
Image conversion script
py - 7.23 kB - 01/05/2018 at 19:56
MPLAB Firmware Project, V1 (Alpha)
Zip Archive - 39.83 kB - 01/05/2018 at 19:56
I previously wrote that a likely candidate for the original microcontroller that this uses is an Elan Microcontrollers EMP series.
Good news, everyone!
You can buy them at LCSC:
They are still one-time programmable, but the datasheets have been translated into English, and they are 17 cents in singles. 11 cents in QTY 100.
It's a 32-bit Cortex M0, and I'm actually considering picking up a few now to do this project properly :)
It's really nice that all boardhouses, ever, send multiple copies of a PCB. If they gave me the option, I would probably usually only order one. That would bite me in the ass, every time.
I like to butcher the first one with cut-up USB cables for power and through-hole LEDs crappily soldered into whatever socket I can access, for initial bring-up and debugging. And a little hot glue, for strength.
Smoke-test and blinky went okay, so I put it all on the real hardware for further development.
Here it is, plugged into my PicKit 3:
Looks awesome! The LEDs are actually slightly too bright to look at while debugging.
I was a little bit worried that all of the LEDs at full brightness might be too much current for the PIC to sink, but it seems to but completely fine. No heating up, and stress-testing is going fine. The code is now adjusted so that each bank of 4 LEDs is on at a time, so technically they're all PWMed at 25%.
I'm releasing the initial PIC code as a file on this project. It's very alpha so there are a few niggling bugs, and it requires some more testing and features, but, if someone wants to get a PCB made and flash it, they totally could.
Planned features, supported by the current hardware:
So there's still lots to come, although most of it will be code changes!
The @oshpark PCBs have arrived!
Actually they arrived a couple weeks ago, but holiday bustle has kept me away from fun stuff.
A little bit of reflow, inspection, and touch-up later:
And, to modify the base PCB, a hot air station makes short work of it. Pop up one side of the IC:
And then the other:
Then the new components are ready to be soldered! 0.65mm isn't that small, good flux, a fine tipped iron and some solder wick are all that's needed to nicely place the headers, flash chip, and the R13 pull-up resistor. I think I used 10k or so.
Remember kids: Always clean off your flux before taking the pictures. I didn't do that here, obviously. How embarrassing. This is the reason I don't really like white solder mask.
On top of that whole mess goes the daughterboard.
Yeah, that's super low profile.
Fits nicely, I like it a lot.
I realise that I never posted what the light looks in its unchanged form.
This is because after the first attempt at testing (earlier in the logs), the thing flew way the fuck across my apartment, and I lost all the batteries. Over time, they started showing up again. One of them was under my fridge, with no direct line of sight, so there was probably some ricochet going on!
Anyway, I tested it out again. Forgive the quality, I didn't have time to mess around with the camera settings, and it's not my bike.
Anyway. PCB arrives soon, I hope to program my own sequences!
Changed the outline a bunch, printed off sheets of paper to mock them up, and then finalised the design.
The available area was much smaller than I originally assumed. It doesn't really have room for the PIC18F14K50 that I was planning on using. That's okay! I have a pile of them, but there are better suited PIC families that are cheap, too.
Although these are much more attractive in @oshpark purple, obviously.
So they're ordered, because I laser cut them out and fit-tested them, and I think they'll work great. They cost $3.95 for three. Ordered in 0.8mm FR4, because I need all the height I can get.
When I bought these bike lights in August, there was only one or two vendors selling them, and they were all the same item.
I've added that first AliExpress link to the components section.
True to AliExpress form, this product has propagated through a bunch of different stores, with minor permutations. It's awesome! Three months later, there's a ton of variation.
So for less than $10, and in some cases less than $4, you can get a whole mess of different paper cover styles, different mounting styles, and probably different LED colours.
Any combination of the word "32 LED Bike Spoke Light" or similar will yield results.
I would suspect that the PCB is identical, but I'd love to get some confirmation! I'd also love to get other people playing along at home - This product is neat and well worth the pocket change, even without a customisable add-on board.
The different mounting styles are the most surprising part of this. That seems like a lot of engineering talent to develop these mounting brackets for what otherwise seems to be a copied style. Here is a selection:
So I'm extra curious to see what the PCB differences are, if any.
Gotta redo it, though.
Had some out-of-civilisation time this weekend to chill and work on boards without distractions.
J2 will be a 1.27mm pitch SMD male header, soldered onto the original microcontroller's empty footprint. Thanks to @christoph and @zakqwy for sanity checking my footprint and stopping me from doing something dumb like special ordering 0.65mm pitch headers.
This is my third board in Upverter, and I'm actually pretty impressed!
It also saves history states in a fun way.
So I laser cut the outline to make sure it will work with my requirements.
It definitely won't. It extends way too far in both directions. I'll redesign the PCB to extend down, just to the left of the LED line.
Fortunately, I think I'll be able to manage shoving it into the case when I have the planar dimensions correct.
I'm still intending to put a scope up to the communication pins on the black box microcontroller at some point, but I don't expect to see anything, or if I do, be able to have any sort of effect on the system.
So the clear solution is to pull the microcontroller off, and then solder some headers in its place. Like how SMD JTAG headers are done.
With a daughterboard that connects to those headers, the world is my oyster in regards to hacking projects. The most obvious first step is to add a Hall Effect sensor, so I can detect wheel rotation.
Other than that, I was able to almost wholesale copy the schematic from #PIC-On-The-Go, which means I also have all of the components on hand. It really was the perfect pinout. I have enough space to do everything I want, and nothing more.
Let's take a closer look at the electronics.
It's extremely difficult to photograph the traces underneath white solder mask, but behold, my best attempt:
From here, and then with a quick assist from my handy multimeter, I have drawn a schematic!
There were a few funny things with this circuit.
The whole bottom-left section, and the connector are unpopulated - Cost reductions on display. U2 is likely an I2C flash chip, all connected to a 4-pin connector and some power switchover circuitry. AT24C02 fits the pinout of the chip, but any flash chip is identical, pretty much.
Not shown are the duplicate LEDs. Matching LEDs on each side are in parallel. On one side, they count from 0-15, and then on the other from 16-30 (there are two D17s, and no D31).
The LED is array is set up in an interesting configuration where each high-side control can select a bank of four LEDs, while the low-side controls which LED in the bank is on.
R11 is a light-dependent resistor, and along with S1 (the vibration switch), this the microcontroller is woken up only when it is dark out, and the device is moving.
Concentrating on the microcontroller, the unusual power and ground pin locations ruled out all of the listings on Digikey.
The first one I found that fits the bill is the EM78P153B. It's manufactured by Elan Microelectronics Corp, and looks like it's seldom seen outside China. Interesting. Most of their consumer line is one-time-programmable or masked memory, so it's unlikely I'll be able to rewrite it.
Side note: someone should start a database of microcontrollers and where special function pins are, to make identification of unmarked ICs easier.
Well first you attach it to your bike.
Then you spin up the wheel.
And then it fails catastrophically. The light bar is fine, but I only managed to recover one of the three batteries.
Note: I don't have the patience to turn this into a GIF right now in any quality way. Taking suggestions or help, otherwise this link might disappear in the future!