WellDone / MoMo-Firmware

Embedded PIC Firmware and hardware designs for the WellDone Mobile Monitor (MoMo).
welldone.org
Other
8 stars 6 forks source link

Update Controller Hardware to Version 4.0 #141

Closed timburke closed 9 years ago

timburke commented 9 years ago

Update controller board to rev 4.0.

We don't have different assembly variants anymore so the combined isn't needed.

Fix pcb build system to properly find eagle in PATH

timburke commented 9 years ago

Note that due to a Cadsoft Regression in Eagle versions 7.0 and 7.1, pcbtool fab cannot create fabrication files in those Eagle versions. You need to either downgrade to 6.5.0 or upgrade to beta version 7.1.1.

This is a known regression in Eagle where it segmentation faults whenever you try to use the CAM processor from the command line... You would have thought they would have tested that feature before shipping...

timcronin commented 9 years ago

I looked at the caps you are using on the RF filter. It doesn't look like they're well characterized at high frequencies. Another option would be to incorporate this component into the design, instead of the 10 pF and 33pF: http://www.digikey.com/product-detail/en/GJM1555C1H200JB01D/490-3120-1-ND/702386

Advantages: Well characterised Cheaper solution than two caps in parallel

Disadvantages: Reduced manufacturability-part is likely to be different from all other caps used on the board.

Comments: This cap will resonate at around 5GHz, and not act like the filter we designed beyond that point. The manufacturer makes a point of putting its characterization data online, which I think lends a little more credence to the choice of the part.

timburke commented 9 years ago

Interesting. Yeah, I could see that being a better option. I was basing the choice of 10 pf and 33pf off this document: http://www.digikey.com/Web%20Export/Supplier%20Content/Nuvoton_816/pdf/nuvoton-ana-102.pdf?redirected=1

which I read as suggesting that the parasitic lead inductance of small value surface mount capacitors was all pretty similar so that a standard 10 pF ceramic cap would self resonate and effectively shunt the 1900 Mhz gsm band and the 33 pF would do the same for the 900 mhz band. What do you think about that?

I'm up for using a well-characterized capacitor or even two to make sure we filter the noise well.

timburke commented 9 years ago

@timcronin Also, the Touchstone 1102 50 V/V amplifier and 25 V/V amplifiers are not stocked at digikey (they have some left-overs but once those run out they won't be stocked again it looks like). The smallest amplification they had was 100 V/V, which means we need to choose a smaller shunt resistor. I picked 51 mohms so that if someone plugged in a micro-usb cable and charged at 480 mA, the TS1102 output at 100X would be 2.45V. Is there a better option do you think? I understand that this will limit our low current resolution b/c of the input offset voltage of the op-amp but I'm not sure if there's a better way. Thoughts?

timcronin commented 9 years ago

The method in the Nuvoton document is sound, given the vague design requirements set out at the start. It works by presenting signals at both frequencies with similar impedences and making those frequencies equidistant, on a log scale from the nearest self resonant frequency of either of the caps. It does not guarantee that the package inductances will be sufficiently small. Neither does the Murata datasheet, of course, but at least it is addressed. That gives me a little more peace of mind. We have room to increase the 20pF to 33pF. It would mean that the self resonant frequency of the cap would drop to ~4GHz, which leaves plenty of margin, because the resonance should be quite narrowband. I think we should only need one if the package inductance is well controlled. Unfortunately, that kind of information can be difficult to come by, but I'll see what I can find.

timcronin commented 9 years ago

I looked around at low cost current amplifiers, which ranged from Maxim having the nerve to charge $2.50 in that bracket to ST's one, http://www.st.com/web/en/resource/technical/document/datasheet/CD00201091.pdf, which costs less than $0.50, but has an unspecified input referred offset.

I then found this:http://www.digikey.com/product-detail/en/TS1103-50EG6T/TS1103-50EG6TCT-ND/3674732, which appears to occupy more digikey inventory than its predecessor. It's also more expensive, but performs very well for what it'll cost.

I'm not sure I can make the call on whether or not your current setup would be good enough. You mentioned previously that we expect <150mA from the panel, which is why I'm confused when I see 480mA, corresponding to somebody charging it. Are you considering using the current measurement for this also?

timburke commented 9 years ago

Okay, yeah let's be more specific. I think one of the issues was that I was trying to change as little as possible in the design, which meant shoehorning things in. Taking a step back, this post will lay out the big picture goal we're trying to accomplish.

Controller Board Power Situation

We made the decision to force all controller boards to have a Li-Ion battery for simplicity and decided to support two means of recharging that battery. 1 is a 5V micro-usb port that's compatible with a standard cellphone charger. The other is a 5-6V solar panel.

We want to measure the current being supplied at least from the solar panel and possibly also from the micro-usb port but I don't think it's super important to measure the usb port charge current since we're assuming that if you have a usb charger available then it will just work and you don't need to do careful accounting of how much current you're getting from it. The solar panel we plan on using has 100-200 mA max current. When plugged into the wall, we want to limit the charging current to < 500 mA so that we don't have to be too careful charging the battery. The battery we plan on using has 1000-1500 mAh capacity so those would be 0.1 to 0.5C worse case charging rates.

Current situation

There is one path for power to come into the board that is shared between the solar panel and the usb port. This goes into a cheap Li-ion charger IC whose only job as we're using it is to current limit the usb port source to < 500 mA. The panel can't provide more than 100-200 mA so it can technically bypass the charger IC. The other function of the charger IC is to provide the ability to disconnect the charge current from the battery if it gets too full. The PIC on the controller samples battery voltage and charge source voltage every 10 seconds and decides whether to enable the charger and charge the battery. This creates three requirements on the current measurement circuit:

  1. Its shunt resistor needs to have a small enough resistance that when 500 mA passes through it, its IR loss is < 0.55V (4.75 is USB min voltage I believe and we want the charger source to have > 4.2V at the charger IC)
  2. We care about measuring low amounts of solar current so we would want to distinguish 1 or 2 mA of current from 0 mA, which sets a boundary on how high our amplifier input offset can be or we need a reliable software calibration to get rid of the input offset effect.
  3. The PIC voltage is 2.8V and we don't want signals > 2.8V on any of the PIC's lines so that they don't bias an ESD protection diode in the chip and have a low impedance path onto the VCC rail. This means that a 500 mA current through the same shunt must not be amplified to more than 2.8V. The PIC ADC has an internal calibrated reference at 2.048V so it would be nice to use that range for the solar current measurements since VCC will not be as precisely regulated.

We want the solution to be as cheap as possible while meeting those three objectives.

Proposed New Power Solution

One way to achieve these goals would be to have separate current paths for the solar panel and usb port combined with a diode-or. The solar panel would have a shunt resistor and amplifier. We would get rid of the li-ion battery charger IC and replace it with a high-side P-FET* to allow for shutting off the charging current. Current limiting from the USB port would be handled with just a simple series resistor sized so that at 5V on the line and 3.2V in the battery the charge current is 500 mA and then gets smaller as the battery charges. We could also add a soft-fuse at 1A to make sure that things don't blow up if someone plugs in a higher voltage source. This would remove the li-ion battery controller IC and let us put the current sense only on the solar panel so that it wouldn't have to worry about having to pass more than 200 mA.

In this scenario the specs we would be looking for on the current sense would be:

Discussion

Do people think this a good idea? Are the specs unclear or is there a better way to achieve our big-picture goal? One of the motivations for this is that our li-ion battery charge may not be playing nice with the solar panel. Since the panel is current limited its voltage crashes near the battery voltage when the li-ion charger turns on, causing it to turn off again and then this cycle repeats. The new design would get rid of the charger IC entirely.

timburke commented 9 years ago

I did a search through all of the digikey op-amps here.

We'll need to specify how much allowable voltage drop we can have across the shunt. I would say 0.1-0.2V. If we're running a 6V @ open-circuit panel then we can expect the max power voltage to be about 0.8*6 = 4.8V. The output current is pretty flat up to close to the max power voltage and we don't need a voltage greater than 4.2V to charge the battery so we have 0.6V to play with. So giving up 0.2V max across the shunt resistor seems fine and would let us use a 1 ohm resistor to get 1 mV/mA reading, which means our requirement for the input offset could be a lot looser, right?

timburke commented 9 years ago

Also, since the panel is floating and we don't need to worry about interfering with the ground reference plane, couldn't we do a low-side measurement and not need an instrumentation amplifier, just a regulator non-inverting op-amp?

timcronin commented 9 years ago

That was an absolute monster of a post. Apologies for the delay. It took me a few days to get my head around.

Regarding the Current Situation section, If we want to use the full resolution of the ADC, we should minimize the effects of input-referred offset in the amplifier. I agree with your approach of increasing the shunt resistor that the input referred offset specs are looser.

Advantages -Large input signal will overpower input-referred noise. We still need to be careful to use op-amps with input referred offset << one least significant bit of our full scale, the 200uV in the TS part was good. I think I've found a cheap border candidate.

Disadvantages -We need more parts-two SM resistors in addition to the op-amp if we implement the low side non-inverting amplifier topology

Regarding the last issue with voltage overdrive at the ADC input, have you considered powering the current sense amplifier from a ~3V line? That way in the event that 500mA passes through the shunt resistor, the output of the sense amp will rail to, and not exceed, a safe input voltage for the PIC.

If you've seen the solar panel and charger fighting, and want to deliver a solar powered solution, the charger, it seems, must go. Out of curiosity, what panel are you using?

timcronin commented 9 years ago

You also mentioned you suggested the solar panel wasn't playing nice with the battery charger. I presume you established this by powering down and bypassing the chip. Are you sure the resonator and schottky diode at the output of the buck converter had no role in the reduced current from the panel? I don't know of any reason why this might happen. If there is a datasheet for the panel, I can look into this further

amcgee commented 9 years ago

This seems to have stabilized and has been tested by Tim (final tests to be run next week). I'm going to merge this.