• Hi;
    I will talk about a couple of hardware issues as I cannot provide any substantial help with the programming. Some USB power sources have internal current sensing that will cause them to sleep if no load current is detected. As a concrete example I have a rechargeable battery back that has two USB outlets (Ativa MobilIT 2400 mAh). When connected to the F3 Discovery board will all the bells and whistles it runs just fine. When I connect it to an Espruino with the HC05 Bluetooth module it runs fine for about 30 seconds and then shuts itself off. When I connect the same battery to an MSP430 Launchpad with a Bluetooth module I get the same shutdown behavior. In both the instances the battery pack decides it does not have a load. Given the amount of press from TI about the MSP430 being the lowest power processor on earth it is very entertaining that the Espruino gives it a run for the money!!
    For the soil resistance sensing there is a standard technique of reversing the current several times during one reading sequence. Set one pin high and the other as the analog input and accumulate the result. Reverse the roles of the pins and do it again; repeat this an even number of times so you have accumulated an equal number reads in each direction. Alternating like this will improve noise immunity against stray earth current and against surface differences in your pins by averaging it toward zero. There is also a concern that the nominal 40k pull down resistor at the inputs are not all equal; this scales your soil current into a voltage. I expect this would be equal on a given chip but vary from chip-to-chip. Alternating would average out pin-to-pin variations on a given chip but the repeatability from one chip to the next could be a problem. If you truly want to calibrate these it may be worthwhile to run a fixed resistor to ground from each pin and not use the internal one; for a one-off I would not bother.
    Cheers,
    Chris Z

About

Avatar for ChrisZ @ChrisZ started