Tuesday, November 20, 2012

Hacking your own PCB

I mentioned a problem with the LM4140 reference voltage as a poor design decision. Adding a capacitor didn’t solve it nor did adding a resistor. Realizing I was unhappy with this I decided to hack the board and put on a voltage divider for the reference voltage.

I explained before but the short is you need a voltage reference in between the +ve voltage and the ground in order to have a single sided amplifier. This reference raises the differential voltage from the strain gauge.

I’ve attached a picture of the old reference resistor and the hack of two resistors and a bridge wire. It’s giving much better stability.

So why is this ultra precise high grade IC failing… because it’s source is a poor linear regulator on the Arduino Pro Micro. So this means that as the supply voltage drifts up and down that means that relative the reference it’s drifting. This is now ratiometric and even if the supply drifts the reference is still at the same “relative” voltage keeping it all nice and stable.

I seriously hate magnetic reed sensors. I dislike how I have to program the microcontroller. V4 will have a MEMs gyro.

DSC_8999

I spent yesterday figuring out how would I program the nRF51422 if I switched to that for development. Kicking myself for missing out on the free board Nordic offered, but even more so for not getting the free day of training. That could be invaluable. However, my self learning has revealed that the nRF51422 is not as scary too deal with. Segger J-Link to 9 pin “JTAG” (not true JTAG as I understand it for the nRF51422 which actually uses a two pin arrangement to program, but it does contain the normal JTAG lines) is all there is to it.

A big issue with this is that if I don’t incorporate an OEM J-LINK means others can’t reprogram it. Mixed feelings on this. Let me know your thoughts? I haven’t decided if V4 will be a minor increment or more major. Feel free to let me know your thoughts via email.

Monday, November 19, 2012

So close!

After a significant amount of work I'm close to being able to show V3 working on a bike. However there are ramifications to my intention to post the code / schematics / pcb. The problem is that the pcb is continually showing faults in the design that should be addressed.

1) I forgot a trace to the AP2, so it's manually grounded

2) I have a broken trace when I had to fix some traces to get the board made. I forgot to connect this one and it has had to be hacked.

3) the precision voltage reference was the worse idea I've had for this entire project. In fact I'm going to hack my own PCB to install two Vishay through hole resistors to sort this horrid deficiency out.

4) Shear gauges on the right arm are not nearly as accurate as double bending arrangement. This should be something of note for anyone interested in StageOne. It hasn't been talked about but if they are using a surface shear gauge you could be introducing some inaccuracy. It works, but the double bending arrangement IS more accurate. This is a thumbs up to Rotor who are using a double bending arrangement inside their crank.

5) Linear voltage regulator sucks power. It's a waste and requires 2 x CR2032 to power the meter with higher drain. Not good. Connecting the 3V coin cell directly with a voltage divider reference is smarter.

6)Size: This is all too large and ridiculous in size.

7) Coin holder: It's terrible

8) Reset / On-Off Switch: Need them

9) ADC / Amp / Gauge should be powered  by an output pin so they can be turned off.

10) nRF51422. This is such an appealing device. The size of an AP2 chip but with a 32bit ARM core. Dual SPI, built in ANT+. But I have 0 true experience with ARM Cortex-M0. So little that I don't even know the equivalent of an ISP and how to even wire the chip to be programmed after assembly.

I'm working on buying a site for the commercial side of this project. So I'm not releasing the name however here is a teaser. A-X-X-X-X-X-X. Maybe I'll release one letter per post!

Wednesday, November 14, 2012

Power Meters - Why

I love bikes. I love riding. I love the feeling of the first ride of the year after being cooped up inside all winter knowing that I’m stronger, faster, fitter, healthier. I even love that feeling as I transition to indoor training where I design my workouts.

In the workout I relish that interval where I have to hold myself back because I know I can push harder. I can waver a few percentage above or below but being under is a sin. It just motivates me to push harder and harder until I am king of the world.

My target heart rates could stay the same as I get fitter and achieving that BPM might be affected by heat, humidity, and elevation but one thing doesn’t change with those factors. My Power. It’s my Power, it’s nobody else's. It’s that one measure, that one thing, that when you improve you know it. I’ve read papers that show little “statistical” difference between HRM and Power meter for short term training, but that’s not why I’m here. I need to know that I’m better than yesterday. And not just yesterday – last week, last month, last year, last race, last training ride. Only power can.

Power is new. It's expensive, but it doesn't have to be. I'm showing it won’t be. My meter is showing the true cost. Why? Because I want power to be in reach of the weekend warrior. I want that return on investment to be the feeling of more power. I want to see these on road and mountain bikes from the factory and not as an expensive upgrade for the rich and elite. That warrior is a pro in his heart so why can’t that person have the pro tools? Maybe you need the basics, maybe you need L/R measure, maybe you need pedal stroke analysis.

You feel great because you know you are better than yesterday, and it didn’t break the bank to get you those metrics. You’re an amateur weekend warrior or a pro, but either way you want to know you’re stronger. You spent all winter making sure that you’re pedal stroke is as smooth an efficient as possible, that your left and right legs are balanced, that your power is greater than last spring.

ANT+ was there first, and will always be the true power meter standard. It was forged by countless unthanked people who toiled to create that standard so that I can use a Garmin Edge with a Quarq, a Joule with an SRM, a Bontrager Node with a Powertap. It was and is being improved by companies willing to not keep that work secret, working to incorporate pedal stroke analysis in the new Power Meter Profile and who knows what else.

That weekend warrior who’s racing has the right to feel like a pro who sprints for the finish and spread their arms as they pass the line. Can you feel it? ANT+ did. I do. Click here and let me know if you feel that way.

Tuesday, November 13, 2012

V3–Update and Naming

Sorry it has been a little while since I’ve updated this. So everyone knows I’m very much committed to this project however I’m constantly running up against minor issues.
Recently I found out that I missed a 0.1 uF cap on the voltage reference causing it to drift and as a result there was a massive loss of resolution but it was hard to detect when you average 10000 samples. Also I’ve come to a realization that commercial units sample WAY WAY WAY less which is why they only claim 1 – 2 % accuracy. Strain gauges are good for way higher accuracy but it’s this combined with inaccuracy of rotational measurement and trying to keep consumption down that drives inaccuracy. So it’s a trade off, a real balancing act.
The latest issue I’m still debugging is that on V3 when I read the ADC’s the AP2 module is not consistent with transmitting. Essentially my serial output is turning to garbage. As a result it’s not transmitting consistently. I’m having a hard time debugging this and that is what I’m working on now.
I’ve gotten several emails over the last couple of weeks. I know right now that some of them have gotten lost in the inbox. I’m going to get to finding and replying. I apologize for this. Unfortunately my day job, exercise, and this project are all competing for attention.
Once this problem is sorted an updated schematic, gerber files and part list will be posted along with some basic code. It will by no means be the end of the project.
Back to debugging!

Also V4+ will have a new name, a more official name.

Sunday, November 4, 2012

Minor Improvements–V2 helps V3 Debug

DSC_8997

Why is the Left crank arm of V2 connected to V3 via frankenwiring? I was experiencing some very peculiar ADC behaviour. It’s hard to see, but next to the LM-4140 reference is now a blue capacitor. Turns out it was drifting very very high and erratically so that as the load changed so did the output. I missed the 0.1uF capacitor that was supposed have been after the regulator. I’ll need to recalibrate it but things are now a bit more stable. I’ve been asked about releasing PCB schematics. I’m not decided on this but this is a good reason not, to at least not yet. I also hold that without training installing strain gauges is a recipe for disaster and wasted money.

Power consumption is still an issue and with the drifting reference voltage solved, I was able to rewrite my “readadcR” routine to the “wiggle” version. My naming conventions aren’t all that sane when testing (I’m “wiggling” on and off a random pin). However interrupting the transfer to switch a pin didn’t impact the overall readout. According to the datasheet it shouldn’t but until it’s tested I believe nothing.

short readadcR() {
digitalWrite(slaveSelectPinR,LOW); // take the SS pin low to select the chip:
byte one = SPI.transfer(0xFF); // send in the address and value via SPI:
byte two = SPI.transfer(0xFF);
byte three = SPI.transfer(0xFF);
digitalWrite(slaveSelectPinR,HIGH); // take the SS pin high to de-select the chip:
return (one << 14 | two << 6 | three >> 2); //output the value from the three bytes as one short
}

short readadcRwiggle() {
digitalWrite(slaveSelectPinR,LOW); // take the SS pin low to select the chip:
digitalWrite(wiggle,HIGH);
byte one = SPI.transfer(0xFF); // send in the address and value via SPI:
digitalWrite(wiggle,LOW);
byte two = SPI.transfer(0xFF);
byte three = SPI.transfer(0xFF);
digitalWrite(slaveSelectPinR,HIGH); // take the SS pin high to de-select the chip:
return (one << 14 | two << 6 | three >> 2); //output the value from the three bytes as one short
}



image



Running the two routines (one reads and averages 10 values then the next routine does the same)yielded the above graph. Very little difference. The difference between the two techniques is highlighted below.



image



It’s obvious that at times the readings are slightly different, but this is on a 65000 value scale and averaged out the difference was 0.38 bits. Pretty insignificant as this should just be the last few bits plus a little offset for reading 10 values then reading 10 other values causing some error as I dynamically load the device.



What does this mean. Earlier here, I showed that currently I’m at 34ma, 17 - 19ma is the bridge itself! That is much too high! I’m targeting a lower value and V4 might not be perfect but it needs to be in the single digits at least. So assuming that reading the ADC takes 3/4 of the time and calculations take 1/4, and there are 3 read periods and only 1 bridge needs to be active for 1/3 of the reading that means that 19ma *1 bridge/2bridges * 1/4 duty cycle = 2.37ma.



Okay, so we dropped 19 to 2.37ma but we can still do better. If I added a minor delay to reduce read cycles in half  (8000/s per side totalling 16000 samples/s) we drop both the bridge and the ADC’s to 1.185 and the adc to 0.4ma. This should in turn put the microcontroller to sleep for effectively half the time, dropping it from 17 to 8. I suspect this is wrong due to the regulator drawing more power.



So current consumption would be at about 10.5ma so far for V4. that should give about 20 – 22 hours of operation. A far cry from Quarq’s 300 hours. I suspect that they must reduce read rates even further leading me to question how much more accurate these devices could be if they scarified operating time. Original Quarq Saturn is listed at 400 hours on a 600mah battery. Total consumption when in operation is just over 1 ma. This is brutally low as I’m still not dealing with the ANT+ current consumption, however that is very very low.