# Connecting the dots.. BikeLightProject

## Would you apreciate (as a car driver) if bicyclists used turn indicators instead of hand signals?

• Total voters
7
Status
Not open for further replies.

#### xarvox

##### New Member
Hello everybody!
I learn by doing, so the best way for me to learn programming and electronics is to define a goal, then try my bestest to find a way to reach it.
I need somewhere to house my build-blog, and figured you guys might appreciate it, if for nothing else, for shits ´n giggles..

This is the main project thread; initial post is all about the current state of things, primarily hardware and will be updated as the build progresses.
This may cause some confusion regarding the chronology of things, stuff gets deleted or changed, but i believe its the easiest way to maintain a easily understandable current state of things for the readers.
I will also be using this thread (specifically its initial post) as a project organizer, keeping it in one place while letting others "monitor" the progress.
Hopefully this will lead to faster development, since its taken me about 2 years to finish version 1(crowsnest of cables) and about a year in developing version 2 (i2c), still not completed.

The goal with the BikeLightProject is, as its name implies, a bike (or vehicle) light controller that will eventually also handle realworld measurements, like speed, heartrate and cadence (pedal cranks rpm).

The route i selected for the Version 2 (current) is I2C-based pin extenders, placed at strategic locations, then connect the vehicle lights to the pin extender breakout boards (n-channel fets).

I designed and ordered custom PCB´s from china (first attempt!) and populated them myself.
Most of them worked out allright, some with small "adjustments", while others had to be scrapped due to designer incompetence..
In case anyone would care to take a looksie, the project is at easyEDA.com so if youre a member(free), drop me a message and i´ll share the project with you.

The above picture is showing the rear breakout card, designed to replace the minimal PCB and batteries inside a over-the-counter bicycle rear light housing. (point 5 in the below picture)

Everything is designed around the 4-wire "bikebus", a i2c-bus with my own name, for no apparent reason.
The bikebus is 5+v, gnd, sda and scl, and the idea is to have the bikebus in a star-configuration, the center-hub being the battery compartment.(point 2 in the below picture).

I threw together a picture to demonstrate my bike and to clarify the layout. ( sorry folks, just realized that the original jpg was mirrored..(CAD purposes))
The bikebus cable will run "like a Y", from point 2 to 5, splitting upwards to point 4 around where point 3 is.
Point 1 will wire directly into the main battery protoboard.

The above picture shows a version of the bike i have (mine has smaller front wheel), but the basics are the same.
The numbers on picture represents:
1: the front gear shifter mast; the location to fix my front lights.
2: the main battery compartment, inside the black tube.
3: the location for the on-button.
4: the handlebar "unit", consisting of the arduino nano headerless board, buttons and FET´s to control the front turn indicators, inside the rear view mirrors.
5: rear light housing, containing the rear i2c breakout box. This is also where the rear (moped) turn indicators are mounted.

At its current state, all the pin extender modules are completed, but not installed, the lights are all modified exept the front extra light (missing a transistor over its ON-button (modeselect, click once for on, next click steps up light output until mode3=full output).

The handlebar unit is also missing (had to scrap the pcb), so im going to build a bare essentials-protoboard, housing the arduino, condensators (button debounce) and front turn indicator FET´s.
Its going to be tight, i have roughtly 19x150mm space to work in, inside a tube.

I ordered waterproof tactile buttons, that will be discretely installed around the brake lever base on both sides that will toggle each function, they will then be covered with tape to keep them in place and hidden.
The brake levers will also be modified, a brake sensor will be installed in each, like shown in the link below:
http://www.avdweb.nl/solar-bike/mechanical-issues/brake-switch.html

And since i will be using internal wiring, a single hole next to each brake lever will let all the leads out, in a (hopefully) neat little (taped) cable, tucked away inside the brake lever body.

Over the coming weeks (while i wait 6-8 weeks for my online purchases) i will be completing the handlebar unit.
I already have a working jumpered protoboard, so its just the matter of minaturizing the circuit and solder it together.

In other words; the project is "nearly" complete, its just lacking the final ingredients, the power module.
The idea is to use a tactile button as a ON-"switch", then keep the system on via software, creating a software OFF, so i dont have to remember turning it off after use.
The link below shows the circuit im planning on using, with the difference that i will be using 2s lipo, 7,4v (or similar li-ion eventually)
http://homecircuits.eu/blog/arduino-low-voltage-disconnect-circuit/
http://homecircuits.eu/blog/arduino-low-voltage-disconnect-circuit/
I have a couple of those cheap voltage regulator PCB´s from ebay, the one with a blue box that has a flathead screw on top, to regulate output voltage.
..I bought them years ago, so their names and exact specs are details of memories past..
But they did have input up to around 20 or 30 volts or so, converting them down to between 3v(or so?) and a number somewhat lower than input voltage.

The main battery board (protoboard with thruhole parts soldered with wires) will also hold the front i2c pin expander, that will control the system-ON FET as well as the front lights via FET´s
The front lights are plural, triple to be precise, where the position light, low beam, is a somewhat weak bicycle light, and the extra light, rally light or high beam (call it what?) is a dual LED cree xm-l t6 high-output light, with its own in-house LEDdriver.

I have ordered a whole bunch of ebay stuff over the past few days, battery monitoring circuits and temperature gauges, BLE-modules and so on, so it feels somewhat moot to try to build the power protoboard before they arrive..

But here´s a list of things that must be on the main power board:

MCP23008, 8-p pin extender (only a few pins used).

Battery input terminal (6-18ish volts)
Connector for "bikebus" cable
PullUp resistors for the i2c bus.

Stuff for the front lights;
2x FET´s, power breakers, one for each front light unit (the dual extralights body still counts as 1)
connectors for the cables to the front lights and the modeSelect transistor (soldered over the original ON button inside the extralight housing).

and stuff for the auto-off circuit:
optocoupler (FOD817B)
FET, main switch ( IRFZ24N, TO-220 )

The "extras":
INA226 Power monitoring module http://www.ebay.com/itm/253111071464
LM75A temperature sensors (battery compartment monitoring)
AT24C32, DS1307 RealTime Clock module
HM10-cc2540 BLE module

I will eventually connect other realWorld sensors to the project, probably using i2c bus to wire them up, but i still havent found ways to add these to the project.
They are primarily hall effect scmitt-triggers for the rotational counters (speed, cadence), but i havent found a way to interrupt via i2c yet (arduino IDE) so i would be forced to use a dedicated cable, all the way up to the handlebar if i´dd try to add these feature now..
And im NOT going back to the old (and removed) crows-nest, with vga-, cat5- and dual lead- cables all over my bike...

Now i just have to figure out how to wire it all together, but in a neat and SAFE way...

And as a final note:
I always appreciate feedback and i can take a "youre an idiot, you cant do it like that", as long as its followed by "because of this".
I sometimes fail to read the correct emotional value behind a certain way of writing, like irony or perhaps misreading constructive criticism as something else, but in the end, i always appreciate the content of the feedback.
And yes, im Autistic.

..and sorry about the wall of text, this is by far my largest project ever, in every way except physical size.

#### Diver300

##### Well-Known Member
There have been lots of bike indicators. I remember one about 35 years ago.

The reason that they haven't caught on is that no-one looks for them, and that would only happen if they were common. That would need them to be compulsory, or so cheap to fit that they become standard on all new bikes. Neither of those will happen as bikes don't usually have electrical systems.

A long time ago my parents had an old car with trafficators, those indicators that stick out of the side of the car. We realised that they weren't being noticed. Indication just didn't work, it wasn't informing other drivers of anything, because they were looking for flashing indicators. We added flashing indicators, and driving became easier.

Similarly, when I went to the USA, where a lot of cars have red indicators at the back, it took me a day or so to understand them without thinking about it.

Both of those examples go to show that indicators are for others, not the driver/rider, and the driver/rider needs to do something expected or it won't be understood.

#### xarvox

##### New Member
Thank you for your input, your participation is valued, especially since we disagree.

I do agree with the part that the average driver expects bicycle-behaviors (and signals) from bicyclists, but i believe that the same driver would immediately recognize the universal inter-vehicle language of indicator lights, should he spot it on anything in traffic.
In other words, even a horse and wagon would be able to communicate its intentions with indicator lights.

And that is exactly what i think the problem was with your parents car, you werent "speaking the language" other drivers were expecting.

I also agree that for most bicyclists, a turn indicator system wouldn't be practical.
However, there are a increasing number of E-bikes around where i live, so there is already quite a bit of electronics fitted on about (guesstimating) 5% of the bikes here.

A few "digital" front/rear bicycle lights and a smarter handlebar speed-controller (with buttons/switches for indicators and so on) wouldn't be that big of an upgrade for an e-bike-owner, especially if it were only a single cable between the units.

A driver expects a number of predetermined signals of lights in all other situations in traffic, so i dont think using those same signals "elsewhere" would confuse anyone, even if it were wearable LEDs on a t-shirt..

Im already a "odd package" in traffic, being a lower vehicle than a Porsche and no pedals where "they should be", and often going twice as fast as other bikes.
This means that i often get mistaken for a strange motorcycle or something and my hand signals are often not noticed..

Back to the project, as a footnote..
Ive been designing a new handlebar controller card, for ordering a PCB, since i had very limited success building a protoboard tiny enough to slide into the handlebar tube (19mm).
Would anyone care to take a help me check my schematic?
To explain some stuff on the schematic;
Ive gone back to the original idea of using i2c pin extenders for the handlebar unit, no more arduino in the handlebar tube.
c1-c4 are to debounce the button inputs, 0,1 µF capacitors.
R1-R4 are pull-ups for the buttons, 1 kOhm resistors.
The i2c solderpad is the main cable connection, power and data input.
the others are for the wiring to the turn indicators (Ti), brake sensors (hall effect switches (BRS)) and buttons (BTNS).

The unknowns;
C5; i do not fully understand these cap´s, but i gather that they help stabilize the power input, that they are supposed to act like a voltage buffer.
Could anyone care to guestimate the size of the C5 capacitor?

Also, im improvising my design since i dont know any better..
Does the PCB look reasonable or am i doing a mistake somewhere?
Trace width is 25 mils for data and 50 for power, way above requirements i guess, but im not good enough to dare go lower..

The AddrSel(012) is for the pin extender i2c address, binary set 1 if pin connected to + (if memory serves correctly). Sorry for the garbled up screen layers, i havent finished polishing it yet..
Since the minimum order is 5x PCB´s, im planning on using these cards in other projects too, hence the i/o (input/output, pin-number) letters with the pads identified with numbers.
The size on the PCB is 50 x 17,7mm or about 1 63/64 inch x 45/64 inch for you yanks.. (see how much simpler the metric system is?? ;-) )

#### Nigel Goodwin

##### Super Moderator
C5 is a decoupling capacitor, and should be as close to the IC as possible - it's value isn't critical - a 1uF would do, as would a 10uF (or a 22uF etc.)

A 'nice' solution would be a 10uF and a 0.1uF in parallel.

#### xarvox

##### New Member
Nigel, thanks for the input, but would you care to elaborate why your 'nice' solution is so nice? What would the parallel caps achieve?
Even better decoupling?

edit:
Nevermind that question Nigel, here´s an explanation:
http://www.capacitorguide.com/coupling-and-decoupling/

#### ronsimpson

##### Well-Known Member
A 'nice' solution would be a 10uF and a 0.1uF in parallel.
care to elaborate why your 'nice' solution is so nice?
A 0.1uF ceramic capacitor is very good at high frequencies. It works well at the speed where the computer is working. But it has little storage.
A 10uF Ele. Cap. does not work well at high frequencies. It does have 100x the storage.

When the computer does the next instruction it pulls power which first comes from the small cap. Before little cap runs out of power, current comes from the large cap, then from the battery which may be on a long wire. The little cap is placed very close to the IC's power pin.

#### xarvox

##### New Member
I did those mods regarding the decoupling cap´s, moved them closer to the VDD pin, added a electrolytic cap (C6).

C5: 100 nF (0.1µF)
C6: 100 µF

Looking good?
(bottom)

-----
(top)

-----
(screenshot from editor)

(red is top layer, blue is bottom layer witch is "mirrored" compared to the bottom pic above, since the PCB is transparent in the editor.)

Im curious, how much juice could one feed thru a via? (25mil wide, 12mil hole).
Ive seen other PCB´s with dual via´s, like on the +5V and GND on my design, making me wonder where its neccisary and where its redundant..
I figured it doesnt hurt to have the dual via´s on my PCB´s, i can afford them, but i only added them on the power lines.

Im about to start designing the power management module too, i figured i should have a factory-made PCB since i will be placing an order anyways..
The shipping is usually around 5 times the cost of a single PCB, so it feels like a silly idea to only order a single PCB...

Last edited:

#### ronsimpson

##### Well-Known Member
it feels like a silly idea to only order a single PCB...
Every PCB house has different ideas. One place I use allows only 1 design/board. If you put down 10 boards on a single board they want more money. Even paying the multi-board fee, it is better to have one big board then 10 different boards. I can have the boards designed to break apart but then they know it is different boards.

What I do, in your case, is to make the LED board and the power board as one and cut then apart. Leave 1/4 inch between the boards for a saw or sheer.

Look carefully at the charges for the board. Most say there is no NRE (set up fee) but there is.
Example: 1 board = $500, 2=$501, 3=$502, ..... what is the set up fee? Example: 1x1 inch board =$500, 2X2 inch = $500, 3X3 inch =$500, 4X4=$500, 5X5 =$505.
Example: One board house I know makes 5 boards minimum. So 6 boards and 10 boards cost the same.

#### xarvox

##### New Member
Yes, im aware of those "issues", however, the "standard" fee is $2 for 5x small boards, but the shipping is often$10-$15.. Last time (the first time) i ordered PCB´s, i did a combination of your suggestions, had a bunch of PCB´s in rows, witch had to be cut apart manually, and added V-grooves between the rows of boards (3 rows in total, 18 separate PCB´s). That way i got those clean and straight long-sides of the boards, while the short-sides were manually cut and sanded. The end price was$35 including shipping for those PCB´s, not too bad concidering the number of PCB´s i got out of it..
The non-lead option (lead-free HASL) was about $10, around the same for shipping and yet again the same for the V-grove, landing the pure PCB-cost to about 5$, or a dollar a piece.

However, this time i will be using multiple orders and combined shipping, ive decided that its way simpler, especially since im only doing two (or possibly 3) PCB´s this time..
That way i wont have to pay anything for v-groves and still get perfect edges with exact dimensions.

EasyEDA doesnt (appear to) charge extra for multiple PCB´s in the same batch, as long as you add the PCB´s one order at a time.
So it will probably be \$2 per PCB, plus 10 for shipping.
They also sell components, like resistors and IC´s and so on, neat that one can place the (parts)order with the BOM-list..
The only thing missing is a automated PCB populating, but concidering the costs at other stores, i wouldt be using that service anyways..

#### shokjok

##### Member
That's a monumental undertaking, given what you described as basically a smart bike. My bicycle trailer and tail lights circuit are now 30 years old. It can be adapted, even copied, for your design.
Changes made since original posting: the 2N3055 and 2N1613 transistors have been removed and replaced by a stand-alone 12VDC 5-pin PC relay feeding the reverse lights, and the radio fuse is now 2A.
The reverse light switch wire now feeds the 5-pin PC relay, with a 4A fuse feeding the 1156 reverse lights. The radio fuse is inside an inline fuse holder for easy replacement and battery charger hookup.

#### Attachments

• 61.9 KB Views: 32

#### xarvox

##### New Member
hehe "monumental undertaking" is a teeny weeny understatement, given that i had practically NO experience with programming or electronics before i started this project 4 years ago..
The first version took me about a year to complete and i was using it for about a year before i decided it was time for a upgrade..
This version has been taking me about 18 months now, to develop the current set of hardware and polish my coding skills..
...and it wont be finished this year, unfortunately..

But it wouldnt be fun if it were easy..

Anyhow,
Ive recieved my PCB´s for the main power module and handlebar input modules and ive populated them and verified that they´re working.

So now its all about programming..

Unfortunately the program code is a bit too big for my brain to handle, almost 1000 lines of code, and its not working as it should.. :/

The current plan is to rewrite the program from scratch, starting with the bluetooth LE-module that will be connected to my android phone, using the phone as project dashboard-display.
So by starting on the output, i can use it to verify each new block of code, instead of trying to troubleshoot the whole code in one go..
But this means i´ll have to learn some android programming first..
Who is over-complicating things? me? i just wanted to learn programming..

In case anyone is interested, ive exported my electrical schematics for the whole project.

The Multiboard.pdf contains the first PCB order, that includes the PCB´s for rear lights, trailer controller and indicator lights.
The arduino board and front light PCB (in the multiboard) are scrapped, replaced with the PowerModule, as well as the old handlebar unit, witch is replaced with NewHandleBarUnit.pdf.

I got the gerber files as well, just drop me a msg in case you want them..

#### Attachments

• 94.8 KB Views: 43
• 44.8 KB Views: 34
• 59.7 KB Views: 56
Status
Not open for further replies.