Archive for the ‘Make’ Category

Voltmeter, Ampermeter, 5 digit 7 segment, my own code

without comments

Few years back I purchased low cost (range of 100€) Power Supply HY3005D, rated for 30V and 5A. Just after few weeks I started to dislike the whole situation with LCD display w/o backlight and w/ really bad viewing angles. First option, for the reseller to give parts for an upgrade, didn’t happen. 2nd DIY backlight solved visibility at low light, but viewing angles remained. Not long ago I searched for voltmeters and ampermeters in this kind of form factor, to fit existing front panel.

Voltmeter

After some measuring and searching on online marketplaces I came across a suitable option: ebay.com/itm/310672415584 (reseller: alice1101983 is recommended and reliable source of electronics kits& parts). I purchased 2x in a wish to change 2nd from Volt to Amp meter. Voltmeter works no problem. Vin is divided through a resistor ladder of 330 kΩ and 20 kΩ. These way input of 0 – 33 V is reduced to 20/(330+20) of Vin.  Knowing that voltage on shunt resistor definitely won’t reach limit I removed both resistors and shorted R3. At that time I didn’t look more into it. Comparison of multimeter and ampermeter on left side of Supply.

voltmeter comparison of multimeter and ampermeter values voltemeter backside

So ampermeter kind of works if you know you need to double the shown number. :) Well, not quite. As far I know resistor ladder can only divide not multiply the input voltage. The whole time I had in my mind I can just reprogram the microcontroller similarly (1|2) and correct the scaling. So I ordered 1 more. Also asked the seller (alice) to contact the possible manufacturer world.taobao.com/item/15073358476.htm. I got a negative replay. Today I decided to contact the supplier shop59318659.taobao.com directly, first using TaoBao online page chat and then using their chat app. Thankfully I found ScreenTranslator that made installation little easier. No matter the unusual time (Friday night in China) supplier responded in English. Of coarse they didn’t gave me changed binaries. That would be awesome indeed. They forwarded me to forum post on this voltmeter. There is a 18bit ADC present (MCP3421, SOT23-6) which is quite nice for whole voltmeter price of 4$ (ADC cost about 1$/pcs @10pcs order).

Schematics:

shema

Design conciderations:
Why not use I2C (pins 11 and 12) that is present in chip? Original bit-bangs I2C over pins 17 and 18.
Using SWIM pin as GPIO is not great for coding and debugging. Specially when this pin is utilized as part of communication (I2C). Download code -> start Debug -> disable Debug

1of5 digit duration  logic_one_frame_voltmeter_3.6V

Ampermeter:

Power supply uses 30 mΩ shunt resistor. Which results in 150 mV @ 5 A. I removed voltage divider resistors and shorted
ADC range is ±2.048 V. Using built in PGA 8x (Programable Gain Amplifier) changed max. voltage range presented to ADC input to 1200 mV. Decided for offset of 28 mA.

shunt resistor max. shunt voltage 160 mA 500 mA

Code:

Coding the segments and digits was easy. Replicating the I2C with similar timings to original needed more brain stretching. Also took me quite a lot of plugging and unplugging of ST-LINK. Last was to code the appropriate scale and possible offset. I did think about using input pin intended for push button, as a trigger for calibration but went with static definition usable in my case.  Also needed to unplug the programmer and plug in power supply.

Dropbox shared folder:
“project” folder

 

Written by luftek

February 28th, 2016 at 3:51 am

Posted in Make,pcb,Reuse