Pixl.js - campervan

Posted on
  • Hi, I've got a Pixl.js in the post. I was to use it in my campervan. Initially I want to monitor voltage of my leisure battery but in time also monitor current being drawn. I want to use DroidScript so I can interact with the Pixl via my phone.

    Looking through the videos

    I want to be able to turn devices on and off and off (maybe to conserve the battery). I've got 2 FET transistors on order.

    I'm happy playing round with a bit of electronics but I guess my main interest is writing the code....

    I've got a load of resistors from a play pack I got years ago and I've worked out that non of the combinations I have will divide the voltage from 14v (max voltage on charge apparently) to 3.3v so I can use the Pixl.js to monitor voltage.

    So any thoughts on the following would be very much appreciated.

    1. Has anyone come across / used any shields that may be useful for the voltage / current quandry?

    2. What's the tolerance for reading voltage on the Pixl.js. Just for info as I guess should never go above 3.3?

    3. Has anyone come across a small/cheap electronics starter pack that will contain enough toys to get something up and running.

    It's a balance between getting something up and running and spending time on the electronics side of things (all to do with what floats your boat).

    Thanks in advance.....

  • Hi & welcome!

    1:
    Simplest would be a voltage divider. You need two resistors, just google it, should be pretty straight forward. But this only measures the voltage.

    If you want to measure current consumption as well, get an INA219, INA226 module from ebay / aliex.

    2: Yes, 3.3V max!

    3: Well, there are all kinds of starter kits, can't recommend one. Cheapest would probably be ebay / aliexpress. I guess also depends on where are you and what you want to do. Sensors? Actuators? LEDs? Analog stuff? Radio? Tons of options :)

  • Following up on 1, you don't strictly need to divide to 3v3 -- you can divide to lower than that and just adjust your code accordingly. That way you can get something up and running quickly until you are able to get the required resistor values to do the 3v3 division.

    I would also second the INA219 / INA226 suggestion, as those modules would do the voltage detection for you over I2C. Additional benefit is that if you happen to miswire things, the module is first in line and would probably give up the magic smoke before the pixl :P (I killed a number of INA219 modules because of reverse polarity while testing some unprotected 18650 cells).

    Speaking of shields, you'll also need to be careful as many Arduino compatible shields assume 5v and may further reduce power to their components (if you wire the pixl such that 5v = 3v3) or might sink more than 3v3 on a pin (if you wire the pixl such that 5v = vin). I just set 5v to 3v3 by shorting the pads, and test the voltages with a multimeter, just to be safe.

  • Ah one more thing about voltage dividers, you can use resistors in a series and their resistances add up. So if for example you have a bunch of 2k resistors, you can put 4 x 2k = 8k on one side and 1 x 2k = 2k on the other side and you'll have max 2.8v from a 14v power supply.

    See https://www.allaboutcircuits.com/tools/v­oltage-divider-calculator/

  • Oooooo brilliant thanks @parasquid.
    I've got 15 resistors and created the 225 combinations to see what output voltage I can achieve (easy enough using a full outer join).
    The best voltage was very low eg 2.3v, which felt too low. My assumption; at this stage; is the higher the voltage (below 3.3 of course) the better the data to understanding nuances of battery charge. I may just be over complicating things.

    Now I know I can connect them in series I have loads more option.

    Thanks for the link, I was using https://ohmslawcalculator.com/voltage-di­vider-calculator

  • Great thanks for pointing me at the INA219/226 - I've ordered 2 x 226....

    Also thanks for the comment about Arduino 5v shields. Noted.....

  • Thanks @AkosLukacs. I'd already investigated voltage dividing.
    I've purchased 2 x INA226 modules so I can get something up and running.

  • The shunt (of 0.1R) looks a bit flimsy to me, but it all depends on the application. Make sure it can handle the Watts it burns or evaporates (unsolders itself). Do you know the maximum Wattage - Volts x Amps - you want consume? ...and what is the Voltage - 12 or 24 or ...?

    If you want to measure the Voltage you have to put the shunt on the high side. To exclude 'side effects' - unexplainable / wrong readings, ensure good individual connections to the 'source' - both rails - for all consumers - loads and probe(s).

    If you want to measure the real energy (Wh), you may need to use a different device: a coulomb counter (see comment at https://e2e.ti.com/support/amplifiers/f/­14/t/778625 about 'using' the INA226 for such purpose).

    Any IC manufacturer has some ICs for that.

    Regarding voltage divider and making sure the input voltage never goes below or above what PixleJS can handle, use a zener diode across the input or better a transient voltage suppressor ( https://www.allaboutcircuits.com/technic­al-articles/transient-voltage-suppressor­s-tvs-an-introduction/ ). Btw, the max that an input of a device can handle is (almost) always dependent on the supply voltage of the device. Since PixleJS can run lower as 3.3V (as the Raytac module does, which PixlJS base), you may consider this the max voltage for input in order to be on the safe side.

  • Even if the voltage out of the divider is 2v3 it still represents the 14v max from your power supply. The only thing you'd be missing out would be the fine grained voltage changes because the interval of 0 - 3v3 would have more values mapped to 0 - 14v as against 0 - 2v3

    I personally just use whatever I have and use them so I can get a prototype running, then later on adjust the components so I can improve accuracy :P

    When connecting resistors in a series for a voltage divider, I also now always triple check the location of the division. Whereas with only two resistors there's just one "junction" for the lower voltage, in a series you'd have many outputs and most of them would be far above the voltage tolerance.

  • Thanks @allObjects....
    At the moment I don't know the maximum watts I will have and to an extent that's the object of the exercise. It's 12v so I guess I may have quite high current at some points.
    I can start small and build....

    Some of the terms are new so I'll catch on eventually... eg high = positive.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Pixl.js - campervan

Posted by Avatar for saj42 @saj42

Actions