Note de ce sujet :
  • Moyenne : 0 (0 vote(s))
  • 1
  • 2
  • 3
  • 4
  • 5
Attempt at cheap homemade version of Harmony
#61
LM7805 are super stable, but sooooo unefficient! Can't believe they still put them on modern RC stuff... They tend to heat up so much that they end up messing with the servo signal when the chip overheats... For flying stuff, it means a crash! Also, When there is a much larger load on the battery (ie. motors), the 7805 starves current and servos/receiver have issues.
-
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
#62
(2017-09-14, 00:14)Normand_Nadon a écrit : LM7805 are super stable, but sooooo unefficient! Can't believe they still put them on modern RC stuff... They tend to heat up so much that they end up messing with the servo signal when the chip overheats... For flying stuff, it means a crash! Also, When there is a much larger load on the battery (ie. motors), the 7805 starves current and servos/receiver have issues.

Actually they are perfect for a low consumption device where efficiency is not a concern. Super Cheap in a Super small package and self protected for overload and heat... You can even add an big PCB with vias (or a heatsink) to compensate for a bad design . Truly awesome in that aspect.

An oscilloscope can be handy to know the capacitor needed on the LDO output. I put some big low ESR just to be sure because I don't have an oscilloscope and my setup can see some high and low spike since it uses regenerative braking with a high speed brushless.
[Image: 115771155117.png]
Répondre
#63
Michael, Thank you for the AppInventor and Arduino code I will give it a try. I've experimented with so many different ways of doing it and not been able to get it to do anything useful with the values received. I'd like to be able to display multiple values on easy to read gauges. Maybe change settings as well be mostly to display data, for example cadence, cadence setting, power, battery %, servo position error.

I’ve now bought a high efficiency UBEC to try out. It has an output of 5 or 6V so gives me the option of giving the servo a bit more torque (3 kg.cm) if needed. High voltage servos are just a little over priced at the moment. I’m planning to completely redesign the whole battery and Arduino arrangement in the near future reducing the voltage to 7.4V, 2 x 18650s. Also bought a genuine Nano to use on this new version to say thank you to Arduino for making this project as success. I’ve used cheap clones so far, just to tempting when they cost a 10th of the price. 

Conveniently I have just realized I can make the code work on a single Arduino. Recently for the power meter I have had to learn a lot more about timers and interrupts. This made me aware that I didn’t need to use a separate timer to monitor each reed switch. All I need is an interrupt set at 1kHz and this runs 2 separate codes one for speed and the other for cadence. 

I tracked down the dodgy cadence measurements to a poor connection of the header pins between the two Arduino’s. That will no longer a problem and the cadence information is now more up to date. Makes a surprisingly big difference to the way it feels to ride, much more responsive. I didn’t realize but sending between the Arduino’s must have been introducing a delay, maybe only one loop, half a second, but that makes all the difference. Should be a little less power hungry now the servo isn’t shifting as much due to random cadence measurements. All together a win win I’m rather pleased about.
- Oran
Répondre
#64
Michael I haven’t forgotten the app for displaying Bluetooth data. I’ve been on holiday and working on the next version of circuit board more details below. I did however have another quick look at it and I think sending the values as Serial.print not Serial.println is going to help a lot. AppInventor doesn’t seem to accept a new line as a delimiter. Next is to send the data as a string like you’re doing, I was still getting weird values.


Since I made the automatic shifter I’ve not done any significant changes to the Arduino, power supply and battery arrangement in the saddle bag. As we’ve been discussing in previous posts there are a few thing I wanted to change.  Unfortunately I don’t think I can get everything small enough to fit in the box with the servo, very close though if I wasn’t using two 18650s.

[Image: KyKU6q.jpg]   [Image: NBHhUJ.jpg]

Still need to add the power supply a bridge rectifier for the front hub dynamo. This will be connected with a 2.5mm jack so I can also use a mains charger if needed.
- Oran
Répondre
#65
I have now made the auto shifter fully automatic and possibly a world first. As far as I know this is the first time BioShift type, cadence varying depending on power, shifting has been used with a CVT. Power meter is now connected  Smile .

The NRF24L01 modules work really well and like I2C if both Arduinos are running the code then data is transferred. No delays and messing around connecting.  

I’ve programmed the shifter to be a torque selector instead of cadence. This alters the relationship between power and cadence. At the moment I’m not using cadence correction, the power data just alters the multiplier and therefore cadence. The worn out hub is really beginning to show with a wide cadence range for a set servo position. A combination of slack in the system, planet axles flopping about in the worn stator slots and the plastic hub interface.

Dispite this the first test ride was a very different experience. Reminded me of when I first uploaded the code to achieve auto shifting. So weird to start applying power and feel that I’m pedalling faster but there isn’t the increase in torque normally required. I think its going to take a bit of fine tuning as I’m finding the cadence changes a little to much but that’s probably due to riding with constant cadence for so long. According to the past data recorded it should be about right. I’m used to knowing my power output from the amount of torque I apply to the pedals. Somewhere in between will probably turn out to be the best.

Example of some data recorded via Bluetooth from the auto shifter. Great to have all the data together for logging. The Bluetooth app allows 7 values to be received they are power, cadence, speed, auto shifter and power meter battery voltage, programmed servo position and power meter zero error. The last one is really useful for checking the power meter as it’s the current stain gauge value minus the zero value calculated during setup.

[Image: Im4Hcp.jpg]
- Oran
Répondre
#66
Made some improvements to the code so now getting much more accurate shifting especially with the power data. First thing to sort out was the low speed shifting and making it work with the worn hub. There is now such a large region of the shift range that does nothing the hub was getting stuck in a low ratio. I’ve fiddled with the offset and multiples to mostly get rid of this, see graph below. There’s still times when the hub resists up shifting but can’t do much about that as its due to the worn stator slots.
[Image: GjqTCG.jpg]
 
Next was to get cadence correction working in fully automatic, power meter connected mode. To make this work I had to create two equations that match up. One calculates the multiplier the other the corresponding cadence and both from the power output data. The relationship I’ve chosen between cadence and power is simply linear for the moment, ((Power/18)+60). However the relationship between cadence and multiplier and therefore power and multiplier is a curve. Currently I am calculating this with a section of a sine wave, ((sin(((Power+powerPrev)/2)/-560))*7)+17.

The accuracy is greatly improved as the graphs below show. However something is not quite right about the code as above 500 – 600 watts cadence suddenly jumps up to over 100 rpm. Not easy to do tests at high power outputs as I can’t maintain it for long. Also noticed that cadence isn’t following the straight line and on another graph it only drops to 60 rpm when power is almost 0. Wondering if the change in cadence is simply due to the cadence correction. 

[Image: 9ND100.jpg] [Image: x57rr7.jpg]
 
Progress is going to slow down on this as I’m having trouble keeping the Welsh weather out of the power meter. Being a prototype its hard to seal everything and the NRF24L01 is mounted externally in just a plastic bag. Got plans to fix that soon with an aerial extension. On top of that at the moment we are getting a bad combination of frosty nights and light rain showers so the roads are constantly wet with salt water. Would be a shame to destroy the power meter prematurely when I could just wait for better weather. Whenever we get some dry weather I’ll be straight out riding as I find fully automatic mode rather addictive.
- Oran
Répondre
#67
Turns out there was a problem with the calculations. Very useful to be able to transmit values to my phone via Bluetooth for live monitoring will riding. This equation for the multiplier ((sin(((Power+powerPrev)/2)/-560))*7)+17 wasn’t working correctly without being fed a float. The change in cadence was due to cadence correction as only the cadence setting equation was working.
With that fixed I then had to fine tune the cadence correction equation to work more smoothly with the ever changing cadence setting. This is where my experiments with PID came in useful. By reducing the amount of proportional and adding the right amount of integral I got rid if the oscillations. These graphs below show the difference between having cadence correction and not.

[Image: bunyA6.jpg] [Image: bwj0bO.jpg]
 
Example of some data recorded, the blue and purple stay pretty close together which makes for an amazing ride experience. Because I’ve become very sensitive to my cadence I can actually estimate my power out by the rpm of my legs.
[Image: yoajca.jpg] [Image: FoHx5N.jpg]
 
I’ve also used what I’ve learnt from this to improve the cadence correction for the constant cadence, no power meter, mode. Always had problems with oscillations at high cadences and sometimes if I changed the cadence setting. Also because the relationship between cadence and multiplier isn’t linear it made sence to have the proportional part of the PID change depending on the multiplier. The result is much smoother operation and no more oscillations. How much better can I make the code. Of course if I get a new hub I’ll probably have to reconfigure everything.
- Oran
Répondre
#68
PID Tuning
Whilst I’ve been doing a more in depth review of Harmony I have switched between different hubs. Each hub has a different amount of slack, shift range and multipliers used. This got me thinking about the values used in the PID of the cadence correction or in my case just the P and I. Maybe it was time I learnt more about PID tuning so I can get it the work as smoothly with the newer N360 as the worn N380.
The basics of PID tuning are to increase P until oscillations occur, half it, then add in as much I and or D without making things become unstable again.  I set off on a ride and had a go at improving the values used with the N380. Here are some screenshots I captured during the process.

Red – cadence, Green – cadence setting, Blue – speed, Orange – battery % (affected by current), Light blue – P + I, Grey  - P and Black – I.
Just P but to much
[Image: GMww6R.png]
Too much I
[Image: Q5fihT.png] 
Too much of both
[Image: Ef2bf3.png]
Just about right
[Image: MubIaq.png] 
The result was that I ended up with the same values as I started with.

Loop speed
Ever since early on in the project I have used half a second for the loop delay and never tried increasing it. After some experimenting it turns out it really doesn’t make any noticeable difference increasing it. The accuracy of the shifting is mostly limited by the servos speed and ability to shift under load. The natural oscillation of my legs and the auto shifter due to too much gain remained similar, 3 seconds +- ½ a sec. So at the end of this turns out things were about optimum but have learnt a lot about setting it up for different hubs.
- Oran
Répondre


Atteindre :


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