Note de ce sujet :
  • Moyenne : 0 (0 vote(s))
  • 1
  • 2
  • 3
  • 4
  • 5
Attempt at cheap homemade version of Harmony
#11
Had a lot of success with modifying the cycle computer code. It gives a very accurate reading of the time between pulses from the reed switch and the output can be scaled to whatever is required.

I then began combining the servo control with the reed switch output without any success. This turned out to be due to the servos pulse width modulation and the reed switch timer both being assigned to timer 1. I looked up some code for controlling the servo using timer 2 instead. With this perfected I tried combining all the code together and this time with great success.
I'm using the wheel rpm reed switch at the moment and the servo position is simply the output from the reed switch timer. I've scaled it so that in full overdrive the cadence is about 60rpm. Then to give a bit of adjustment I've added the pot value scaled so that it various above and below 0.

There's still a bit of fine tuning to do. The output of the reed switch timer often goes high at very slow speeds. The servo position value needs to be given limits so that the servo isn't driven beyond the limits of the cables. I'd also like to use the switch on the handlebars to change between manual and automatic modes.

A test ride soon revealed that it works amazingly well, can't really believe how well. It can keep up with the shifting and accurately despite the timer output being once a second.

Here's a short video of it working with the bicycle stationary and the wheel off the ground.

- Oran
Répondre
#12
Wow! Impressive work there!
What makes the shifting go by steps? It waits for the next two wheel rotations to compute the RPM and then reacts?

Envoyé depuis l'application mobile Tapatalk.
-
Si ça a déjà été fait, je peux le faire
Si ça n`a jamais été fait, donnez-moi juste le temps de trouver comment !


Répondre
#13
Thanks Normand, I'm rather impressed by it as well and I'm the one who made it.
The steps are simply due to the output of the reed switch timer being set to once a second. Its exaggerated because the wheel is off the ground and accelerating faster than it normally would. Out on the road its very hard to notice these steps. Because it shifts immediately to the correct value determined by wheel rpm it never gets behind by much even when accelerating hard. A slight delay increases cadence which is what I want anyway when accelerating.
Something I need to do next is learn how the timer code works. I tried increasing the output rate but got error messages. Something that would improve the accuracy at low rpm would be to add more magnets to the wheel. I think Fallbrook use 6 on their Harmony but another one would help a lot.
- Oran
Répondre
#14
Done a few miles recently and its doing very well. I've combined the two codes for auto and manual and can change between them using a switch on the handlebars.

The irregular shifting at low rpm turned out to be due to a map function used to scale the output of the reed switch timer. It wasn't necessary as the timer output can be adjusted anyway.

Adding extra magnets to the wheel fortunately wasn't necessary and wouldn't have worked anyway. Another magnet means half the time period and half the top speed the timer can cope with without modification. There needs to be a minimum time period to stop false reading from any switch bounce. So there are limits but currently it works well between 5 and 35mph.
- Oran
Répondre
#15
You are seriously amazing! This setup, while a bit on the heavy side, is really well done!

Envoyé depuis l'application mobile Tapatalk.
-
Si ça a déjà été fait, je peux le faire
Si ça n`a jamais été fait, donnez-moi juste le temps de trouver comment !


Répondre
#16
Heavy it sure is and a little heavy on the battery compared to yours. To be honest with the hills in Wales it's borderline sometimes as to whether just having a NuVinci hub is viable. On todays ride the road went over the top of a small mountain. A climb of 500m and steep in places but it was doable.
[Image: WP_20160528_012_zpsqw5gtswt.jpg]
For riding around a flat town or city it's just the best thing I've experienced on a bicycle since I first got a NuVinci hub.

I'm starting to get an idea of the battery life (11.1V 3.2Ah). My estimate is somewhere around 120 - 130 miles which I'm happy enough with. That's a charge every 1 to 2 weeks with my current mileage. Got 80 miles out of a charge then realized I was only charging to 11.6V or around 65% not 12.6V or 4.2V per cell.

Future improvements

There's obviously work to be done on tidying up the electrics. I want to swap to an Arduino Nano and use a 9 pin connecter for all the wires to the bicycle. Then the battery, power supply and Arduino can be removed with one simple connecter to undo.
If the servo can be weatherproofed in a more compact way I'd like to mount it close to the hub to minimize cable length.

Further into the future

To truly automate the shifting it would need to respond to the amount of pressure or torque applied to the pedals. Its that which should be maintained reasonably constant and not so much cadence.
Getting the most out of it in its current state takes a little bit of practice. At first I was relying too much on the Arduino to do everything and was finding I was pedaling too slow on climbs and too fast when the road levelled out. Now I'm getting better at using the potentiometer to adjust my cadence. The beauty of using the Arduino is that I only have to think about how much faster or slower I want to pedal. There's non of that process of adjusting the ratio as the speed of the bike changes and for that I think it is well worth it.
- Oran
Répondre
#17
A update on a few improvements.

I've done nearly 400miles and its so far been 100% reliable. The battery life is a lot better than I had predicted. I'm currently 8 miles away from 200miles on one charge and the battery voltage is 11.16V.
I've tidied up the wiring and swapped to an Arduino Nano. This means I now have room in the saddle bag for something like a spare inner tube.

[Image: WP_20160619_017_zpscvxddciw.jpg]
[Image: WP_20160619_020_zpsnmqdrk6k.jpg]

I've also been working on some improvements to the Arduino code. The first and very minor one is to double the shift speed from once a second to every half a second. Seems like the error messages I got before were due to something else, its happy enough at 0.5secs. I will see how it affects battery life over the next few hundred miles. Also if it has any noticeable difference on the ride experience if not its best at once a second.

The next improvement which if successful will make it better than Fallbrook's Harmony is to get it working fully auto on the small chainring. It's currently the only annoying thing about it that once I shift off the big chainring I have to make big adjustments to the ratio. Also because the relationship between wheel speed and ratio is no longer correct its not really auto shifting either. I never used the cadence reed switch so I want to make it into a derailleur position switch. This will tell the Arduino which number to multiple the reed switch timer output by if I'm using the big ring or the small ring. In theory it should automatically adjust the hubs ratio as I change chainrings.
I've got the code to partially work but so far with small numbers only otherwise it outputs negative numbers. I'm a little surprised by this because the reed timer code and the number I'm changing is in the void setup part of the code. I thought this only ran once and I'm feeding a number into it from the void loop section of the code.
- Oran
Répondre
#18
What is the big aluminium heat sink for?

Envoyé depuis l'application mobile Tapatalk.
-
Si ça a déjà été fait, je peux le faire
Si ça n`a jamais été fait, donnez-moi juste le temps de trouver comment !


Répondre
#19
Its a slightly oversized but hopefully reliable waterproof industrial grade 5V power supply. Its only powering the servo as I'm using the Arduino's onboard regulator. I thought it was better to keep the servo motor and the electronics separated from each other.

Just been on a ride with the increase shift speed and it really makes a difference. I'd been so impressed by its ability to shift by itself I hadn't noticed how it wasn't keeping up with the shifting as well as it could be. Its noticeable during acceleration and during down shifting as I slow at the bottom of a steep gradient.
- Oran
Répondre
#20
I've got the code working for the shifting between big and small rings. So my setup is now better than Fallbrooks Harmory. I'm using the cadence reed switch and glued a magnet onto the derailleur. It works really well, as the chain moves between chainrings the hubs ratio shifts up or down by the right amount.

[Image: WP_20160707_017_zps3cttrdgp.jpg]

Also been making further improvements to the Arduino code. This time I'm thinking about the relationship between wheel speed and servo position. I realised that when starting off I had not been allowing the bike speed to increase and the correct cadence to be reached before the servo starts to shift. Conveniently the servo needs a value of between 540 and 2450. So by reducing the offset of 540 I can delay the start of the servo shifting as I accelerate. The complicated part is that reducing the offset means I have to increase the multiplier so that the top value remains the same. Then of course the value I want the servo to start shifting at has then changed. I have two variables that are linked to each other.

Its going to take a bit of trial and error to get the values right. Having the shifting start too early is beneficial when accelerating to compensate for lag. On the other hand it makes a big difference on the hills if it down shifts correctly. Otherwise the speed has to drop to almost zero before it shifts into full underdrive. The ideal values will probably be somewhere in between.

I was going to comment on how reliable it has been having done nearly 500miles without a single issue. However last weekend the Arduino Nano just stopped working when I was out on a ride. Tried uploading code to it but no response so the original Uno is now back in use.
Made me rethink my method of wiring and making the Arduino easily swappable. I'm going to make a socket for the Nano out of 2 ribbon cable ends wired into a 9 pin connecter. I can then carry a spare Arduino with the code preloaded.

The other thing I might do is have 2 Arduino's one with an auto code the other with manual. To switch between modes I would power up the correct Arduino. This would obviously increase the chance of still being able to shift if one failed. Riding single speed wasn't really a big deal but it spoiled the end of the ride a little.
- Oran
Répondre


Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)