ACS758LCB Current sensor

Development & General Chat for the superb openxvario project.

Moderator: rainer

Post Reply
bbq
Posts: 31
Joined: Fri May 11, 2018 5:31 pm
Country: -

ACS758LCB Current sensor

Post by bbq » Thu May 17, 2018 7:50 am

ACS758 50A Vo pin need add Capacitor to GROUND ? i only add 0.1uF vcc to GROUND.

bbq
Posts: 31
Joined: Fri May 11, 2018 5:31 pm
Country: -

Re: ACS758LCB Current sensor

Post by bbq » Thu May 17, 2018 6:26 pm

can use on X12S use FROS ?

bbq
Posts: 31
Joined: Fri May 11, 2018 5:31 pm
Country: -

Re: ACS758LCB Current sensor

Post by bbq » Sun May 20, 2018 8:54 am

Why can't I change to ten digits in (define MVOLT_AT_ZERO_AMP)? If I set it to 600, I normally say A in TX, but when I change to 620, there is a problem. In TX, it means 294996736.0 A. The value in consump is 238565. But it changes to Only one hundred digits. It is normal to connect to (efine REFERENCE_VOLTAGE). Can't have hundreds of digits, but only thousands of digits?

Carbo
Posts: 336
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: ACS758LCB Current sensor

Post by Carbo » Sun May 20, 2018 5:23 pm

Did you read chapter 6 in oXs_config_description.h ?
You may connect your ACS to every analog in A0 ... A7, but A4 and A5 are eventually already used by GY63. Which one do you use?
Which power supply for Arduino do you use and where is it connected? RAW or VCC?
Please post your 2 config files here.
If everything in 6. is configured correctly, you will get reasonable numbers for current.

bbq
Posts: 31
Joined: Fri May 11, 2018 5:31 pm
Country: -

Re: ACS758LCB Current sensor

Post by bbq » Mon May 21, 2018 8:58 am

// ***** 6.1 - Voltage Reference to measure voltages and current *****
//#define USE_INTERNAL_REFERENCE // uncomment this line if you use 1.1 volt internal reference instead of Vcc (voltage divider mst be used to reduce voltages to 1.1 volt max)
//#define USE_EXTERNAL_REFERENCE // uncomment this line if you use an external reference instead of Vcc
//#define REFERENCE_VOLTAGE 4400 // set value in milliVolt; if commented, oXs will use or 1100 (if internal ref is used) or 5000 (if internal ref is not used)

// ***** 6.5 - Current parameters *****
#define PIN_CURRENTSENSOR 6 // Arduino pin used to measure the voltage provided by a current sensor
#define MVOLT_AT_ZERO_AMP 600 // in millivolt
#define MVOLT_PER_AMP 68 // in milliVolt per Amp
#define RESISTOR_TO_GROUND_FOR_CURRENT 0 // put as comment or set to 0 if no divider is used (e.g. 19.8 for 1.1 internal ref)
#define RESISTOR_TO_CURRENT_SENSOR 0 // put as comment or set to 0 if no divider is used (e.g 39 for 1.1 internal ref)
Attachments
IMG_20370727_161345.jpg


bbq
Posts: 31
Joined: Fri May 11, 2018 5:31 pm
Country: -

Re: ACS758LCB Current sensor

Post by bbq » Mon May 21, 2018 9:04 am

ACS Vo to A6, RAW 6.4v,ACS VCC to arduino Mini Nano 5V

bbq
Posts: 31
Joined: Fri May 11, 2018 5:31 pm
Country: -

Re: ACS758LCB Current sensor

Post by bbq » Mon May 21, 2018 9:06 am

// ***** 6.2 - Voltage parameters *****
#define PIN_VOLTAGE 2 , 8 , 8 , 8 , 8 , 8 // Fill 6 values; set to 0 up to 7 for analog pins A0 up to A7 ; set the value to 8 for the voltage(s) not to be measured.
#define RESISTOR_TO_GROUND 0 , 0 , 0 , 0 , 0 , 0 // set value to 0 when no divider is used for a voltage; can contains decimals
#define RESISTOR_TO_VOLTAGE 0 , 0 , 0 , 0 , 0 , 0 // set value to 0 when no divider is used for a voltage; can contains decimals
#define OFFSET_VOLTAGE 0 , 0 , 0 , 0 , 0 , 0 // optionnal, can be negative, must be integer, in principe in mv
#define SCALE_VOLTAGE 204.6 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0

Carbo
Posts: 336
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: ACS758LCB Current sensor

Post by Carbo » Mon May 21, 2018 9:59 am

Power supply is perfect. If you want, you can measure VCC with a DVM and change the line 118 (advanced):

//#define REFERENCE_VOLTAGE 4970 // set value in milliVolt; if commented, oXs will use or 1100 (if internal ref is used) or 5000 (if internal ref is not used)

into

#define REFERENCE_VOLTAGE xxxx // set value in milliVolt; if commented, oXs will use or 1100 (if internal ref is used) or 5000 (if internal ref is not used)

with xxxx = your measured VCC in mV. Otherwise oXs will use 5000mV as reference voltage.

Please find attached the files, configured for a MS5611 vario, ACS758 on A6 and an analog voltage on A2.

There is a huge scale for Volt_1, is this correct? You need to define a field in 2.1 (basic) for Volt_1, in my example it's VFAS.

Code: Select all

// ***** 6.2 - Voltage parameters *****
// Spalte:		  Volt_1 ,Volt_2 ,Volt_3 ,Volt_4 ,Volt_5 ,Volt_6
#define PIN_VOLTAGE          2   ,   8   ,   8   ,   8   ,   8   ,   8     // Fill 6 values; set to 0 up to 7 for analog pins A0 up to A7 ; set the value to 8 for the voltage(s) not to be measured.
#define RESISTOR_TO_GROUND   0   ,   0   ,   0   ,   0   ,   0   ,   0     // set value to 0 when no divider is used for a voltage; can contains decimals 
#define RESISTOR_TO_VOLTAGE  0   ,   0   ,   0   ,   0   ,   0   ,   0     // set value to 0 when no divider is used for a voltage; can contains decimals 
#define OFFSET_VOLTAGE       0   ,   0   ,   0   ,   0   ,   0   ,   0     // optionnal, can be negative, must be integer, in principe in mv
#define SCALE_VOLTAGE      204.6 ,  1.0  ,  1.0  ,  1.0  ,  1.0  ,  1.0    // optionnal, can be negative, can have decimals
Here are my values for ACS758, but they need to be verified. Presumably MVOLT_AT_ZERO_AMP and MVOLT_PER_AMP need to be adapted.

Code: Select all

// ***** 6.5 - Current parameters  *****
#define PIN_CURRENTSENSOR   6  //      Arduino pin used to measure the voltage provided by a current sensor
#define MVOLT_AT_ZERO_AMP              600    // in millivolt
#define MVOLT_PER_AMP                  80     // in milliVolt per Amp
#define RESISTOR_TO_GROUND_FOR_CURRENT  0   // put as comment or set to 0 if no divider is used (e.g. 19.8 for 1.1 internal ref)
#define RESISTOR_TO_CURRENT_SENSOR      0   // put as comment or set to 0 if no divider is used (e.g  39   for 1.1 internal ref)
openXsensor.zip
(339.13 KiB) Downloaded 24 times

bbq
Posts: 31
Joined: Fri May 11, 2018 5:31 pm
Country: -

Re: ACS758LCB Current sensor

Post by bbq » Mon May 21, 2018 10:30 am

my current + temperature sensors
temperature use A2
i check ACS 758 VCC is 5.01V,but if me change (define MVOLT_AT_ZERO_AMP) to 620,will error

// ***** 2.1 - Frsky data *****
//#define VFAS_SOURCE VOLT_1
//#define FUEL_SOURCE ADS_VOLT_1
//#define A3_SOURCE ADS_VOLT_1
//#define A4_SOURCE ADS_VOLT_3
//#define ACCX_SOURCE TEST_1
//#define ACCY_SOURCE TEST_2
//#define ACCZ_SOURCE TEST_3
#define T1_SOURCE VOLT_1
//#define T2_SOURCE ADS_VOLT_4
Attachments
IMG_20370727_161345.jpg
oXs_config_basic.h
(11.18 KiB) Downloaded 91 times
oXs_config_advanced.h
(18.98 KiB) Downloaded 97 times

Carbo
Posts: 336
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: ACS758LCB Current sensor

Post by Carbo » Mon May 21, 2018 11:26 am

When i used your config files, everything worked here flawlessly. Using OpenTX2.2.1 on a X9D.

Can you try to use my copied folder:
openXsensor.zip
(339.14 KiB) Downloaded 37 times

Carbo
Posts: 336
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: ACS758LCB Current sensor

Post by Carbo » Mon May 21, 2018 11:36 am

Some ACS are labeled wrong and are indeed bidirectional. You can try to change MVOLT_AT_ZERO_AMP to 2500 and test again - or measure analog out first with a DVM. Eventually your Horus (FrTX?) has an issue with negative numbers (simply guessed)

bbq
Posts: 31
Joined: Fri May 11, 2018 5:31 pm
Country: -

Re: ACS758LCB Current sensor

Post by bbq » Mon May 21, 2018 12:11 pm

i check ACS Vo on 0 Amp is 0.6 V,i think is unidirectional sensor

bbq
Posts: 31
Joined: Fri May 11, 2018 5:31 pm
Country: -

Re: ACS758LCB Current sensor

Post by bbq » Mon May 21, 2018 12:12 pm

maybe this is FROS Problem !
try use opentx 2.2

mstrens
Posts: 1206
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: ACS758LCB Current sensor

Post by mstrens » Mon May 21, 2018 12:13 pm

if you have a voltmeter, can you measure the voltages provided by you current sensor for 2 values of the current
- first when the current is very low (e.g. motor off)
- second when the current is high (motor running).
Please report the 2 values.
If you have a unidirectional sensor, did you try to reverse the direction the current goes into the sensor?

bbq
Posts: 31
Joined: Fri May 11, 2018 5:31 pm
Country: -

Re: ACS758LCB Current sensor

Post by bbq » Mon May 21, 2018 1:19 pm

i change X12S use opentx 2.2 all become ok ,now can change MVOLT_AT_ZERO_AMP to 620 no error.
Attachments
IMG_20180521_210502.jpg

Carbo
Posts: 336
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: ACS758LCB Current sensor

Post by Carbo » Mon May 21, 2018 2:18 pm

The boss is back, good to see you again here, Michel :)

This ist strange, at least for me. When i simulated bbq's config, i have also tried values < MVOLT_AT_ZERO_AMP. OpenTX shows 0, but no errors.

bbq
Posts: 31
Joined: Fri May 11, 2018 5:31 pm
Country: -

Re: ACS758LCB Current sensor

Post by bbq » Mon May 21, 2018 3:02 pm

maybe is FROS problem,use opentx all ok .use FROS 1505 FW
define MVOLT_AT_ZERO_AMP can't use 620,only can on 600 an if 610 sometime will error,but on opentx all ok

Post Reply

Return to “OpenXVario - an open source vario supported by the open source firmwares!!”