Byseekel

2023-07-17

Foreword

This blogpost will be a disappointment. A recollection of wasted efforts, a mausoleum of failed designs, a journal of regrettable choices, and a maker's acceptance of defeat.

Oh, and it won't be proofread.

Last year, I began building a draft of this blogpost, but never finished nor published. It was timestamped 2022-05-03. I wish I could write this one in the same cheerful tone, but I can't.

The project started in December 2021. It was finished in July 2023. A rational question to ask is:

What the fuck happened??

Bikeblinkers: a recap

In September 2021 I broke my wrist in a cycling accident. It gave me an irrational obsession for cycling safety. So I designed this.

A pair of PCB-form blinkers in a plastic bottle, mounted at the rear of
a bike. One of them is blinking.

▲ This is the only photo I have.

It's basically just a 555 timer in astable mode. Two design errors were made:

  • The switch is on the path to the LEDs, not the 555, so the chip is always consuming power
  • The transistors are in common-collector mode, so they aren't bright enough

I was not satisfied.

Byseekel rev 0, 1, and 2

December 2021, I went back home with all the Bikeblinker stuff. Finally I had time to make something better.

I wanted a whole bunch more features, including

  • speedometer and odometer, using reed switch and wheel-mounted magnet
  • hazard light
  • braking indicator
  • remote-activated buzzer
  • an LCD display

At that point, every one of these seemed possible. I smugly named the project "Byseekel" because that's how I hear Freddie sing "Bicycle race".

Rev 0 is on perfboard. I don't even remember how painful it was to solder. Nevertheless, it worked. Photo on 2022-01-01.

Two perfboards with messy wiring

▲ I don't know why I needed three voltage boosters.

🎖️ Achievement made: spaghetti wires

Same two perfboards, front side up

I used two microcontrollers (MCUs), because I didn't know how to reliably switch in and out of sleep mode. The smaller one is an ATmega ATtiny13A

The LCD was intended to go on the handlebar. It was driven with a 4-bit parallel interface. I wrote the driver myself with the datasheet, so I was very proud. (It was very glitchy, though)

🎖️ Achievement made: First LCD driver

Starting from Rev 1, I gave in and just made PCBs. This one's taken 2023-01-12.

PCB with a freshly soldered chip

▲ I was proud of being able to solder SMT, but it wasn't a good idea.

🎖️ Achievement made: First functioning SMT chip

This board is basically just a single chip and many connectors and jumpers. These include

  • J1: barrel jack, but instead of 9 or 12, it's 5 volts
  • J2: SPI, to flash firmware into the chip
  • J3: an Ethernet port because I need exactly 8 wires (genius moment)
  • J4: screw connectors
  • J5: controls array of 4 relays to turn blinkers on and off
  • JP1: a jumper to disable the relays before programming, because they share wires, and if I don't pull it out the relay goes "click clack" nonstop
  • J6: I thought it'd be cool if I had a few "hackable" pins for future use
  • U2: radio receiver unit

But I fucked up. It's impossible to install U2 and J3 at the same time, because U2 is wider than printed on the PCB. I had completely forgotten.

Fixed in Rev 2. The only photo, 2023-01-18.

Soldered and wired PCB

Also, in Rev 1 I forgot I needed a receptacle for the Ethernet cable. So I put that in Rev 2.

Rendering of a PCB with a breakout board

▲ I didn't use mousebites so JDB did not charge me extra. I used a handsaw to break them apart. Would not do again.

The main problem with Rev 0 to 2 is the relay. Though they make a satisfying noise, they are way too power hungry for a battery powered device.

I was not satisfied.

Rev 3

There are too many flaws with Rev 2. I decided to revamp the design completely.

Problem: The relay is too power hungry.
Solution: Use transistors.

Problem: I can no longer afford more SMT MCUs.
Solution: Use DIP.

Problem: I want a marquee-style blinker.
Solution: 5 outputs instead of 2.

Problem: 4-bit parallel interface is unstable and wastes wires.
Solution: I2C.

Let's begin by introducing designs I didn't throw away.

Controller board

I intentionally made it credit-card sized. This was in March 2022.

Front and back of PCB

Stalks

A pair of stalks. One has exposed leads

Blinker stalks for electric motorbikes. They're very cheap. You just pull the lever to the left or right, or both to get hazard lights. Press down to reset.

LED strips

Planned red for brakes also, but now only yellow for blinkers. Scraped off some epoxy and soldered wires to the common anode and five cathodes. The voltage booster converts 5V to 12V.

The end of an unsoldered LED strip

▲ Then I sealed it in transparent heat shrink tube for waterproof.

Radio module

433MHz OOK radio receiver, controlled with a garage door remote. Can store and respond to four keys. Currently assigned three to:

  • Lock (beep-beep, goes to sleep mode)
  • FindMyBike™ (long beep)
  • FindMyBike™ Silent Mode (flash blinkers)

Buzzer

It's just a piezo with two LEDs. It beeps when you give it 12V.

Anatomical view of buzzer

Ethernet cable

In my original design I needed a bundle of eight wires that runs the entire length of my bike. An ethernet cable is a bundle of eight wires. Genius idea.

Now that I only need three, it's still a genius idea because it's cheap and so much easier to organize than three speaker wires.

Now, we'll move on to designs that failed.

Failed designs

Don't ask a Shanghainese what happened in 2022.

Anyway, I stayed at home from March to June, without access to my bicycle or stuff like oscilloscopes. So many ideas worked on my workbench, but couldn't be tested.

Line sketch of two boards. Stemming from controller board: power bank,
blinkers, braking lights, buzzer, reed. In between: ethernet cable.
Control panel board: ctrl, stalk, LCD, brake

In the end, they grew so complicated I had to throw them away.

braking lights, reed, ctrl, LCD, brake and the control panel are crossed
out

2024-02-14 update: There was another version of this blogpost that I scrapped and rewrote, where you may find some of these dead ideas and bad puns.

Speedometer & odometer

My uni has a required 80km of jogging per semester, tracked by GPS to ensure you're neither too fast or too slow. We cheat it by cycling. Based on my knowledge, I can stick a magnet to the spoke of the wheel, and mount a reed switch somewhere so each time the magnet passes, we know the wheel made one turn.

Problem is, it was winter break, and my bike wasn't home. So to test the mechanism, I just held the magnet in my hand and went "whoosh whoosh whoosh".

Did it work? On paper, yes. In practice? Probably not.

Then why did I attempt anyway? Perhaps it's because I hate jogging so much. My superinflated maker ego was like, "Company xxx made this so I must also be able to." Wrong. There are limits as to what one person can do at home, even if it "sounds possible".

Right now, 80km is no longer a requirement for me, so I just dropped the idea, along with the LCD and control panel.

LCD

It's a pity I cut it out. It almost worked.

The LCD would serve as a HUD for:

  • speed in km/h and min/km
  • trip and total mileage (stored in EEPROM)
  • status of blinkers, brake, and hazard light

I bought an I2C-to-4-bit adaptor board, and rewrote my driver (based on Sovichea Tep's TWI driver).

🎖️ Achievement made: First I2C LCD driver

The LCD was less glitchy than in parallel mode. In parallel, when the GPIO switched, the voltage overshot before it damped down. Thanks to Kliment, I learned this was called ringing. But the dedicated circuitry for I2C damps harder, so there's less of this problem.

Less, not none though.

Control panel

One of the ideas that seem good on paper.

CAD rendering. A stack of boards with parts sandwiched
in.

▲ Made with FreeCAD.

Sometimes, you just feel too confident. You think you're a god. You think you can do anything, including mechanical engineering.

The intention is to laser cut eight pieces of acrylic, and bolt them together. All seemed perfect.

Laser cut contours

In November 2022 I tried to cut them. But the laser cutter didn't like the dxf exported from FreeCAD via Inkscape. Each edge was not one line but two, so the laser head went over each edge twice. RIP acrylic.

Acrylic with severely burnt edges

Ctrl button

The ctrl button was supposed to switch the HUD when pressed and enter sleep mode when held.

Brake

The brake detection is the single least realistic design I've ever come up with. I can't believe how I let it pass. I won't waste time trying to explain it again. Here's a figure I drew last year. Go figure.

Dormant state and revival

I did practically nothing for the project between October 2022 to March 2023, because DON'T ASK A SHANGHAINESE WHAT HAPPENED IN 2022. Anyway, in April 2023 I found myself motivated once again, partly because there's a new hackerspace.

I got this box in 2022. Now I'm finally doing things to it. Horrible, horrible things.

Left: a badly drilled hole on the box. Right: buzzer inserted to said
hole.

▲ I didn't have a suitable grinder, so I just drilled around until the small holes formed a big hole.

Left: the box put vertically in the basket; blinkers taped to basket
rim. Right: Stalk taped to handlebar.

▲ This made the bicycle difficult to steer, so later I moved the box to the back.

Byseekel, now

What does Byseekel look like, now that I killed every feature I wasn't ready for?

We've gone full circle.

Bikeblinkers was blinkers you controlled with a stalk. Right now, Byseekel is essentially the same thing.

Except:

  • better stalk
  • better wiring
  • powered by MCU
  • marquee
  • FindMyBike™
  • IP-somewhat waterproof

Note that, although there's an ATmega328P, after all the features I killed it's essentially the same as your typical Arduino code.

When I have photos and videos, I will post them here.

2023-07-17 update

Left: interior of a box, containing a PCB on top of a lithium battery.
Right: same box mounted to a bike

▲ It's mounted with tape, and when it rained, I just cover the box with a plastic bag. Am I an engineer now?

So far I've easily rode it around for more than 50 km. The tape seems to be holding it together pretty well, even on bumpy roads. The box has been exposed to hours of direct sunlight in 38C weather and rain that made the campus quite literally a water park and the lithium battery hasn't exploded or caught fire. This is all I ever wanted.

2023-07-22 update

MPEG-4 Video (4.6 MiB)

Conclusion

Whose fault is it that Byseekel wasn't finished until now?

  • It is my fault that I overcomplicated the project
  • It is not my fault that I was locked home for half a year

I am now speaking to future self.

Do you want to add a "useful feature" to a project? You gotta get the project working without it first. A new batch of PCBs cost 30 RMB. That's cheaper than hours of time you'd waste otherwise. Don't sit on your computer, working your ass to make your CAD model "perfect". You can't know what's perfect if you never test it.

If I had another chance, I'd kill the brake and reed ideas. The LCD taught me to write I2C drivers, and to write AVR C with interrupts; I'd give it a pass.

Always remember, do one thing and do it well.

The KiCad and AVR C files for Byseekel and Bikeblinkers are on Codeberg.