Adding a little Raspberry Pi to my 82'Heritage Special.

Why is your auto-cancel on a different board? Couldn't you just write a script for the micro controller to calculate the distance traveled from the reed switch and shut the flasher off when the calculation reaches a certain threshold? Is that a difference between the pi and a MC? I don't know anything about arduino other than it uses a ton less power.
 
All the components will be on one board, I'm hoping to fit everything in the schematic on one 30mm x 70mm prefab prototyping pcb. Ebay

The arduino code starts measuring distance traveled when the turn signals are activated.
When the distance hits 500' the flasher is turned off.
When the turn signals are activated again the arduino turns the flasher back on and resets the distance counter.

It would work just fine as-is. It seems that nobody has actually reverse engineered the stock auto-canceller.
Some posts indicate that it's just a 500' shutoff others seem to think there's a time component too.
I personally think the 500' distance measure should be adequate but I wanted to code a time function just in case I want to add it later.
 
Way to get creative! I like where you you guys are going with this.

With regard to the auto cancel signals. 500' is an arbitrary number. I don't know how you use your signals, but when I'm at "highway" speeds on rural roads, I put my signal on earlier to let other motorists know I plan to slow down and turn - up the road a ways maybe, but I'm just letting them know. I do this a few seconds before I begin to slow down. This usually gets them slowing down and increasing their distance from me. I found the auto cancel was real bother as I'd have to turn the signals back on before I made my turn.

You have a reed switch at your disposal. It can provide both distance and speed data via calculations. The speed could be estimated during the first few seconds after the signals are activated. The distance for shutoff could then be set based on the initial speed. The higher the speed, the longer the distance. With reasonable minimum and maximum distances.

The time function (if used) should also have a speed factor. If one is stopped in traffic, the timer should not be counting down. What is a reasonable speed? Walking? 10 kph? I'm not sure how slow our bikes will go when idling in first gear, but I do know I don't like doing it for long! Above the threshold speed, the timer would be active. I don't think is time function is that relavent, but maybe it is?

Dave
 
Dave,

Thanks for the idea. Although this idea would increase the difficulty of programming, I suppose staying alive is worth the extra effort.:wink2: That said, I am going to try and build upon it and keep brainstorming this. Personally, I am not going to have a reed switch right away so I will have to press the button again to shut off and have a time factor (~2 min I think) as a backup shut off.

With a reed switch, you are absolutely correct, one would turn on a turn signal 1000 - 2000 feet before the turn (in the country). So lets think through how to make this work. We are cruising at 55 when we turn on our signal. At this point, we are only going to slow down until we make the turn so we can say Keep the signal on as long as we are decellerating. At this point one of two things will happen, we will either come to a stop or we get the green light and can go on through so how do we account for that? How about upon acceleration, go 500 then shut off. Okay so now we are stuck in traffic. Our turn is coming up but the cars in front are stop and go. At this point, the signal will shut off every time you move forward 10 feet. Now given that the slowest road speed generally encountered is at schools at 20mph and that is also about the highest speed through a 90 degree turn. So instead why don't we say Upon acceleration AND a speed greater than 20mph, go 500 feet then shut off. Now our distance limit will not initiate until we are in the middle of the intersection under most circumstances. The numbers can be adjusted easily to suit you normal driving conditions.

What do you think BS360. Do you think that is possible?
 
That's the issue I was thinking might be addressed with a time component. A speed calculation would be required, and I was wanting to code that eventually anyways.

One option I was thinking about while at work today is making the shutoff distance depend on speed. There could be two distances, 500 ft for city speeds and maybe 1000' if driving at highway speeds.
Alternatively the distance could be proportional with speed. At city speeds the lowest distance could be 500' but a function could increase that proportionally as speeds increase above city driving to a maximum of 1000' or whatever arbitrary number would be a good maximum.

Trying to factor-in acceleration or deceleration might lead to too many false-shutoffs, a complain with the original auto-canceler.

As for the reed switch, my XS360 at least comes it stock. There's a reed switch inside the speedo that is wired to the auto-canceller connector.
I'm taking advantage of the existing hardware.
 
How is the bike going to know if its in the city or country to have two distances?

I think the false shut-offs would be minimized with the 20 mph thing. You could also do a rate of acceleration variable as well because if traffic in front of you is start stop over 20mph, you not not going to be accelerating all that fast. That would eliminate most if not all false shut-offs I would think.

I also just though of another idea that would be easy to implement but maybe not aesthetically pleasing. You could put yet another reed switch over the fender between the headers and glue your magnet to the back of the fender. The switch would be normally closed (going straight). Once you started making your turn, the fender would pull away from the switch and open. That's when the 500 feet would start. That would make it operate just like a car's turn signal. The more I think about it the more I like that idea. the shocks might be a problem though.

How about the switch in front of the gas tank and the magnet on fork tree somehow? Might work but I'm not in front of mine to tell.
 
Seems like you ought to be able to figure out what kind of signals it's outputting with a multimeter and just wire into those lines as needed, no? That's my intuition, but I'm a total novice at this stuff.
 
How is the bike going to know if its in the city or country to have two distances?
For that possibility I was just thinking the two distance options would be based on two speed ranges. Maybe 0-55mph would be 500' and 55+ would be 1000' (examples).

I think I prefer the proportional version that would start at 500' and scale smoothly with increases of speed up to 1000' (or something higher than 500' anyways).

I think the false shut-offs would be minimized with the 20 mph thing. You could also do a rate of acceleration variable as well because if traffic in front of you is start stop over 20mph, you not not going to be accelerating all that fast. That would eliminate most if not all false shut-offs I would think.
That'd probably work. Or just not count any movement under 10 mph against the shutoff distance.

I also just though of another idea that would be easy to implement but maybe not aesthetically pleasing. You could put yet another reed switch over the fender between the headers and glue your magnet to the back of the fender. The switch would be normally closed (going straight). Once you started making your turn, the fender would pull away from the switch and open. That's when the 500 feet would start. That would make it operate just like a car's turn signal. The more I think about it the more I like that idea. the shocks might be a problem though.

How about the switch in front of the gas tank and the magnet on fork tree somehow? Might work but I'm not in front of mine to tell.
That'd be one way to do it. I'm trying to minimize any additional wiring beyond the flasher and auto-cancel connectors. That's why the built-in reed switch is great.
At this point the only additional wiring I'm considering adding outside the unit would be an RPM sensor and maybe, well in the future, an LCD screen.

There's another option that'd work: a tilt sensor. Some new bikes use them in their auto-cancelers.
I don't know what angle they choose but they detect the change of angle as the bike turns and uses that input to signal the auto-canceler function.
The great thing there is that they can go right inside the case with the arduino/Pi. No additional mounting required.

Just found this on dimecity. Can we do anything with this? We might be able to use this bad boy and save a little bit of hassle Maybe?
http://www.dimecitycycles.com/acewel...torcycles.html
Looks like it could be a good way to go all-digital and replace the stock speedometer.
I'll be keeping the stock speedo so the built-in reed switch will work fine for my purposes.

It'd be pretty cool if there's one that would fit where the tach cable goes into the engine for an RPM reading.
 
Not much going on this friday night so I installed my modified fuse box and new, non-stripped, points cover screws.
Then I hit the code.

Using the reed switch input from the auto-cancel connector the arduino calculates instantaneous speed and a poorly coded 10-second average speed (average speed code needs to be rewritten).

Based on the average speed the arduino adjusts the distance used to turn off the flashers.

The arduino turns off the flashers after a set distance if the speed is below a certain amount.
As the speed increases above that amount the arduino increases the distance proportionally at a rate that will make the distance equal a preset maximum at a preset maximum speed.

Currently:
minimum distance is 400' @ 19mph (30km/h - school zone speed in Canada)
Maximum distance is 1000' @ 56mph (90km/h - typical highway speed in Canada)

For example, at the highest "speed" I was able to press the button on the breadboard, 34.58mph, the formula adjusted the distance to turn off the flashers to 652'.
At the city speed limit here of 50km/h (31mph), the unit would turn off the flashers after 595 feet.

These numbers are all subject to tweaking. The minimum speed could be increased to the 50km/h speed limit and the minimum distance increased to 500'. The arduino knows to scale properly between the speeds and distances.
Once I get my bike on the road, and a prototype on it, I'll figure out pretty quick if the distances are too short or the speeds off.

The whole thing could be rewritten if a tilt-sensor were added.
In that case the distance calculation might not be needed at all. Leave the flashers on forever until the bike tilts/turns, then turn off after an arbitrary but short amount, maybe 50'.
Finding the right angle would be the problem there. Too high and the signals wouldn't turn off if the bike didn't tilt that much to make a turn.
Might be a way to predetermine the angle for any turn at any speed. Slow speed turns would not involve as much tilt as higher speed ones would.

EDIT: Just realized that currently the user has no way to manually turn off the signals....
 
EDIT: Just realized that currently the user has no way to manually turn off the signals....

:laughing:

That is really cool and much farther along then mine. Hopefully, tweaking those numbers will do it for you. I remain a bit skeptical. I feel like the theory is more sound than the application but I hope I'm wrong. That tilt switch sounds pretty good. You would have to make sure you don't tilt while your waiting at the stop light. Fortunately, our bikes are pretty short so maintaining them vertical definitely wouldn't be too hard. Any links to one?
 
As long as there's a short distance added after the tilt that they flashers stay on, tilting while waiting for the light wouldn't be a problem. Even if the flashers only stay on for another 50' after the tilt, whether it's just before the turn or while turning, they have served their purpose.

This guy wrote up a guide for gyro sensors and the Pi: http://ozzmaker.com/2013/04/29/guide-to-interfacing-a-gyro-and-accelerometer-with-a-raspberry-pi/
The sensor he links to is a bit expensive though at $20 each.

Cheap chinese gyro sensors for the arduino can be bought on Ebay for around $3 each. I'm not familiar with the Pi's GPIO but it might be possible to use those smaller, cheaper versions with it.
 
Ran into a speed bump. My pi went on the fritz after a month. I apparently had it stored in a bad location and some mice crawled around on it and corroded the board. Gotta love old country homes. Couldn't do any GPIO programming without the pi. I just got it replaced. This time I got both a case and a breadboard to make things easier.

Also seems that both my wifi and bluetooth dongles are not natively supported by the pi. Figures... I have been fighting with that since my new pi cam in.

I did find an awesome tutorial series on GPIO programming: http://raspi.tv/rpi-gpio Hope this helps someone.
 
Damn rodents! Did you at least replace with the lower power version?

Mine is on hold until a new arduino arrives. Accidentally applied 12v to the 5v supply pin and fried it.
Ordered two versions. Another Nano and an even smaller Pro Mini.

Realized that I was wrong about not having a manual shutoff. The handlebar shutoff cuts the whole thing when pressed in. Stoch functionality will be the same.

Also realized the stock flasher bought on eBay doesn't work. No flashing. :(
 
I replaced it with another B+. It seems to have a lot more functionality with only slightly more power consumption. Leaves things open for upgrades later on. If it ends up being a problem, downgrading to an A+ shouldn't be too hard. Everything should be able to be transferred aver with the SD card.
 
Here is the rough draft of my Wiring Schematic. I'm looking for any recommendations that anybody has and general proofreading to make sure I didn't screw anything up. I didn't really color code the wiring too much yet.

I did include two Pi bypass switches. It should provide power to the ignition and the headlight, just enough to limp home in the case of pi failure. The ignition switch will be a keyed switch to provide security.

Once we get the wiring diagram nailed down, I will see about adding it to the schematic thread.

EDIT: Here are links to the image and TinyCAD files:

Image

TinyCAD
 

Attachments

  • My Schematic with Pi.jpg
    My Schematic with Pi.jpg
    114.4 KB · Views: 277
Last edited:
Are you using the stock handlebar switch with the turn signal switch?
If so, it can handle left/right selection on its own without the need for separate relays for left and right.

What kind of relays are you using? What's their current draw? The GPIO pins on the Pi might not be able to handle the demand of the relays on their own.
When I looked into choosing options for my arduino I looked at some small mechanical relays but their current draw was 45mA each. Too much for the arduino.
Looks like the Pi B can handle 16mA per pin to a total of 50mA. Not sure about the B+.



Still waiting on my new arduino but I had an idea for installing "angel eye" LED rings inside the stock turn signals as running lights. They'd be wired each individually through the normally closed contacts of a relay, with the control voltage applied from the turn signal circuit. They'd be on constantly until the turn signal is activated at which time they would alternate flashing with the turn signals, on when they're off, off when they're on.
Just an idea, separate but related to the Pi/Arduino controllers.
 
And I get called crazy for wanting to buy stroker rods :laugh:

You guys are going all out with this. Will be nice to see the working results.
 
Are you using the stock handlebar switch with the turn signal switch?

Something similar to this. I'm going to upgrade to 1 or 1-1/8" bars and mount the switches inside the bar.

What kind of relays are you using?

Here is the Relay board I'm using. I have already tested it with the GPIO pins on the Pi and it didn't seem to hurt anything, even when all the relays were on at once.
 
You know, I was just thinking that some much more knowledgeable person could probably come up with an app that connects via bluetooth and turns your phone screen into a remote control to control the relay board. You could then just buy a phone mount for your handlebars and skip the wiring to the handlebars completely. After a little searching, there are already some apps that do similar things but I'm not sure as to the effectiveness of this situation. It would also provide a good level of security since it couldn't be operated without the phone.
 
Back
Top