Version 1.1 of Jeti AmpSensor is out!
Changes from previous version
- Current measuring is now more stable – Requires one added resistor
- Added voltage calibration (A request)
- Corrected error in capacity-calculation!
As said, a small hardware-change is required, schematic is updated on the sensor-page.
Also remember to reset sensor to defaults and re-do the setup! There’s small changes in EEPROM-saving that require this. If not done sensor will not work correctly.
New voltage-calibration screen.
Big Thanks!
Especially big thanks to JJ for extensive testing and patience with me shooting with questions and sending beta-firmware’s, some working and some not :)
Also very big thanks to Uwe for reminding me how n00b I still am with programming! :) I had a very beginner-error with capacity-calculation, it is now corrected thanks to Uwe!
Where?
As usual, in the dadicated sensor-page HERE!
Have you ever wired this up to a Mauch power module?
No, at least not yet :)
I have had massive problems with the ampsensor. Problem was that when I thottled the motor up the more power it got the more the ampsensor missed to update the capacity part (mAh). When I completely removed the sensor module and fixed the voltage and current values in the software (illiminating the sensors), the problem was still there. Then I removed the red wire to the receiver and feed the arduino with an external BEC and battery so the only connection between the arduino and the receiver was the ground wire and the telemetry (yellow) wire. Same problem!! I realized that some sort of noise was send from the ESC via the receivers yellow wire (on the EXT connector) to the arduino and the more I throttled the motor up the worser it became.
A 2,7 KiloOhm resistor was laying on my kitchen table and I connected it between ground and the yellow telemetry cable on the arduino board. It actually worked!!
After I soldered the sensor board back in place and flashed the arduino with the right firmware I tried the whole thing in the model and I ran a fully charged battery to almost empty on various throttle (mostly full throttle) and when I recharged the battery I put allmost the same charge back as the ampsensor told that I have used.
So now im very happy and if anybody out there have the same problem then I am allmost certain that this fix will do the trick. I dont know if the resistor has the "right" value but it works perfect.
I still have problems figuring out exactly what was going on. My best and only guess is that the noise from the ESC was able to bring the clock generator on the board to a halt (I know how this sound….).
Before I get the thing to work I tried to put a 2,7KiloOhm resistor between the sensor board and the 100nF capacitor (which I changed to a 1uF tantal). Now I see that something similar has been done in the new version so I have leaved it as this.
With the new Version 1.1 firmware it still behaves perfectly.
I have found a serious flaw in the program.
It turns out that if the current is about 6.6A or lower the mAh counter wont increase at all. Furthermore the mAh does not "count enough" at higher amps.
I found out that the bug has to do with the fact that the variable "uCapacity" is of the "long" type.
I fixed the bug by making a new "float"-variable "RealuCapacity" in the "Jeti_Init.h" this way:
// Jeti values
float uCurrent = 0;
long uCapacity = 0;
float RealuCapacity = 0; //New variable
float uVoltage = 0;
long uPower = 0;
long jetiCurrent = 0;
long jetiVoltage = 0;
Furthermore I changed the mAh calculation part to this:
// mAh calculation 2 times a second
if (millis() > prevMillis + 500) {
curMillis = millis() – prevMillis;
RealuCapacity = RealuCapacity + uCurrent * curMillis / 3600;
uCapacity = int(RealuCapacity);
prevMillis = millis();
}
I also get rid of the variable "tmpCap" because I could not understand the use of it. Maybe this was uninsightfull and/or arrogant.
By the way: Now it measures mAh perfect!! :)
Please give the specs on setup used i testing? This does not correlate on some other tests done. Not saying you’re wrong but need more info :)
The setup: A brushless motor that draws about 52A at full power together with a YEP 80A ESC. It is a 4s setup and the resistors on the Ampsensor are the ones used in a max 6s configuration. When the system draw under about 6,6A the mAh-counter doesn't count at all. When I gave full power and let the system drain 800mAh (according to the mAh sensor) I could put charge a little under 900mAh to the battery. The most annoying part was that it didn't count at all at very low throttle…..
The next thing I did was to remove the whole thing from the plane and give the variable "uCurrent" the fixed value of 5A in this way in the "Jeti_Runtime.h"-module:
uCurrent = 5.0; //(mVoltCur – ACSoffset + tempcurCalVal) / mVperAmp;
I also gave the variable "uVoltage" a fixed value of 15,33V in this way: (But that actually dosn't matter at all).
uVoltage = 15.33; //(analogRead(analogInVolt) / 1023.0) * (5010 / 1000) / divider * (voltCalVal / 1000.0);
When I fired the system up with just a Jeti Rsat2 and an external power supply (no esc or motor) the mAh counter didn't count at all (just like in the plane). So no hardware was actually involved in the experiment.
The next thing I did was to change the "uCurrent"-variable to 50A and now the mAh counter was counting! I tried to run it for one minut and the reading was about 760mAh where it should have been 833mAh.
With the code changed to what i wrote in my previous post the reading was about 80mAh and a little over 800mAh with the "uCurrent"-variable set to 5A and 50A respektive.
With the preset values of "uCurrent" and "Voltage" removed I reprogrammed the arduino and tested it in the plane again and now the mAh counter worked all the way from idle to full power. and the amount of power I charged back to the battery was very very close to the value indicated by the mAh-counter.
I am now 99% sure that there is no more bugs. Of course the code could be cleaned up but it works!!
I have made 4 ampsensors. Three with 100A unidirectional currentsensors (for my two planes and one for my buddys plane) and one with a 200A unidirectional currentsensor (for one of my helicopters).
Now I just want it to be spring, the grass on the flying field to be lawned and use these wondefull sensors :)
I hope that I have been clear. I am not very used to English (or programming for that matter).
I find it a bit strange since it have been working with others, at least according logfiles they sent me :)
Could you send me your code as a zip via contact-page so I can do a comparison?
Well it DID work well before but now it works perfect like the IMU's from Jeti.
I have send you the code.
Ok, I’ll take a look after work today. Sometimes money-making work disturbs hobbies :)