Show Posts
Pages: 1 ... 23 24 [25] 26
361  Forum 2005-2010 (read only) / Exhibition / Re: Smart battery discharger/tester on: November 22, 2009, 12:23:50 pm
Oops... forgot the code   :smiley

Here it is
//Battery monitoring      V1      Basic edition
// Copyleft KAS         November 2009

#define     VMIN              700           // Battery protection      Vmin > WMIN
#define     WMAX              2000          // Transistor protection   Wmax < WMAX
#define     LOOP              2000          // loop time (ms)

#define     Vpin              0             // battery voltage pin
#define     Apin              1             // Amp reading pin
#define     RELAY             3             // relay pin

long loopTime = LOOP;
long loopUsedTime = LOOP;
long loopStart = 0;
float mVolt = 0;
float mAmp = 0;
float mW = 0;
float mAmpH = 0;
long loopCount = 0;
boolean testOn = false;

void setup()  {
  pinMode(RELAY, OUTPUT);
  digitalWrite(RELAY,HIGH);                     // Close relay
  testOn = true;

void loop()  {
  loopStart = millis();
  mVolt = getmVolts();
  mAmp = getmAmps();
  mW = (mAmp * mVolt) /1000;
  mAmpH += mAmp * loopTime / 3600 /1000;
  if(testOn)    display();
  else          while(1);                    // Loops forever
  testStop(VMIN, WMAX);

  loopUsedTime = millis()-loopStart;
  if(loopUsedTime < LOOP)         delay(LOOP - loopUsedTime);
  loopTime = millis() - loopStart;

int getmVolts()  {
  return int(analogRead(Vpin)*4.8828125);          // read the battery voltage

int getmAmps()  {
  return int(analogRead(Apin)*4.8828125/0.47);      // read the Amps

void display()  {
  Serial.print(loopCount/(60000/LOOP));                Serial.print(":");
  if(((loopCount%(60000/LOOP))*LOOP/1000)<10)          Serial.print("0");
  Serial.print((loopCount%(60000/LOOP))*LOOP/1000);    Serial.print("    ");
  Serial.print((int)mVolt);                            Serial.print(" mV   ");
  Serial.print((int)mAmp);                             Serial.print(" mA   ");
  Serial.print((int)mW);                               Serial.print(" mW       ");
  Serial.print((int)mAmpH);                            Serial.println(" mAh");

void testStop(float Vmin, float Wmax)  {
  if((mVolt < Vmin)||(mW > Wmax))
  {  digitalWrite(RELAY,LOW);                      // disconnect tested battery
     testOn = false;
362  Forum 2005-2010 (read only) / Exhibition / Smart battery discharger/tester on: November 20, 2009, 09:47:50 am

Some (most) of us are P*R**L*X renegades  smiley-wink
During this Dark Age, I built a battery discharger using a 12V lamp as resistive load. This was the good old time when an Analog Input had to be emulated through an RC circuit...
The purpose of such a device is to evaluate the actual capability of a AA (R6) battery, in term of mAh
This smart version is based on an electronic load, with fixed/adjustable discharge current.

Here it is:

Smart battery discharger/tester diagram

The NPN transistor acts as a variable resistor
Current is sensed through a shunt resistor; the corresponding voltage is fed back to the inverting input of an OpAmp configured as a comparator. The non inverting input is set at a reference voltage value through an adjustable voltage divider.
In an effort to have both input at the  same level, the OpAmp will output the adequate signal which is fed to the NPN transistor base
To avoid full depletion of the battery, a relay disconnects the battery below 500mV. This sub miniature relay is directly driven by the Arduino
I used TIP41C and LM324, but any GP OpAmp and NPN transistor will fit the bill; just make sure that the max allowable collector current is over 2 Amps.
Volts and Amps are acquired through AI0 and AI1, mAh are computed by integrating Amp over time

Breaboard implementation

Caution: This device is designed to convert electric power to HEAT  :o
The power dissipation can be calculated, or simulated in LTSpice
according to datasheet, the TIP41C transistor can dissipate up to 65W. Don't take the info for granted; this value assumes that collector temperature remains at 25°C which is unrealistic.
For more than a couple of Watts, install a suitable radiator on the component.
To avoid destroying the component it is advisable to limit max power within the code

LTSpice simulation       X axis = potentiometer wiper relative position (0-100%)

Arduino code is straightforward. The main point is to create a fixed time loop for accurate mAh integration.

What I learnt on batteries:
Not all batteries are created equal; I get results from 662 to 2764 mAh (all AA size)
Ageing does reduce battery capacity; some batteries where discarded after test
Internal resistance is a real issue, 1500 mAmp will definitely bring voltage down, below 1 Volt.

What I learnt as a bonus:
NPN Bipolar Junction Transistor in the active region, versus saturation region
Operational amplifier (comparator configuration)
Circuit simulation using LTSPICE (a magic world)
and... learning to post on a message board

Additional readings
TIP41C datasheet:
LM324 datasheet:
LTSpice Homepage:
LTSpice Tutorial:

Next steps
- Add some decoupling capacitor (should I ???)
- Take into account Base/Emitter current in calculation
- Use a MCP3208 12 bits A/D Converter for further accuracy
- install an LCD display and piezo buzzer for stand alone operation
- reconnect to PC for graphical trends of voltage versus time

Thanks for reading
363  Forum 2005-2010 (read only) / Exhibition / Re: Parametric mixer on: September 19, 2010, 08:13:55 am
Hi Selfonlypath, nice to see you here  smiley smiley

Your work and findings are now too advanced for most lurkers, including me
Anycase keep up your track, I supect it is the right one
364  Forum 2005-2010 (read only) / Exhibition / Re: Solid State Tesla coil on: July 12, 2010, 12:42:34 pm
I have no clue if ZPE can be extracted or even exists, but I can admit that all energy has not been identified and accounted.
Therefore this energy could be extracted (not created) without violating conservation of energy and/or thermodynamic laws.

Oh... one more point
Some centuries ago, a person trying to work on, say... electricity, would have been considered as a witch and sentenced to be burnt at the stake
If you are looking for "intellectual shocks" , read some quantum theory articles

We all now that deviating from mainstream ideas can't turn out to be difficult at best, and sometime to be dangerous...
365  Forum 2005-2010 (read only) / Exhibition / Re: Solid State Tesla coil on: December 15, 2009, 04:04:40 pm
Hi Selfonlypath,

Thanks for your prompt response
I have difficulties to find  IL610 and MCP1403 in my (our  smiley-wink) country
Please let me know where you sourced those parts

366  Forum 2005-2010 (read only) / Exhibition / Re: Solid State Tesla coil on: December 14, 2009, 04:12:40 pm
Hi selfonlypath

For your video #7, you implemented the AN25 opto / IRF840 FET  combination
what is your current setup for video #8 ???
Do you use IL610 isolator ?? any FET driver ?? which Mosfet ??
What about a IL610 / Logic level Mosfet combination ??

Thanks for your help
367  Forum 2005-2010 (read only) / Exhibition / Re: Solid State Tesla coil on: November 25, 2009, 05:46:14 am
Thanks for the code, I will experiment with it
Can I assume it is valid both for Duemilanove and Mega  ??

Keep up the good job   smiley-wink
368  Forum 2005-2010 (read only) / Exhibition / Re: Solid State Tesla coil on: November 24, 2009, 01:07:59 pm
Thanks for your prompt response

Well, I had to train myself hard on this domain because not too much info about this so far which is why I started my YouTube channel plus also a private blog
I have seen the 7 videos; You really should build a web site, I strongly suspect that, beyond plasma technology, you have a lot of other ideas to share  smiley-wink

The trick is to control pulse length, frequency of pulse length and voltage
Would you please let us have a relevant Arduino code snipet for the PWM management ??

369  Forum 2005-2010 (read only) / Exhibition / Re: Solid State Tesla coil on: November 24, 2009, 04:09:24 am
Please note that if you're confortable in building mosfet drivers and opto-isolators, just buy a plasma globe made in China (really cheap for 5" or 8" globe), remove its electronic board to only keep it High Voltage transformer & the globe. After you just need to PWM pulse

Would you care sharing with us the basics for producing the adequate signal to feed a small plasma ball, from an Arduino ?
Any pointer to a Web site ??
A simple circuit with only one mosfet should be adequate
Do we really need opto's for such a small device ??

TIA   smiley-razz
370  Forum 2005-2010 (read only) / Exhibition / Re: Ball Balance Machine II on: May 02, 2010, 09:51:31 am
Hi 0zimbra0

Welcome to the forum, thanks for being here  smiley  smiley

I noticed that you connections with the servos are made of plastic material, why is it so?
I would possibly expect rigidity issues with this design

Thanks for this very creative project
371  Forum 2005-2010 (read only) / Exhibition / Re: Ball Balance Machine II on: April 24, 2010, 03:32:41 pm
ABC-King, TchnclFl, and everybody

I suggest you leave a message on youtube
We need this guy here  :smiley :smiley
372  Forum 2005-2010 (read only) / Exhibition / Ball Balance Machine II on: April 24, 2010, 09:13:25 am
This project is incredible  :o  :o  :o

Have a look here:
I really hope that the autor will accept to give more information here
373  Forum 2005-2010 (read only) / Exhibition / Re: My first CNC machine Arduino Mega controlled!!!! on: November 20, 2009, 12:43:03 pm

Please document your project  smiley-razz
374  Forum 2005-2010 (read only) / Exhibition / Re: (Yet another) balancing robot on: April 24, 2010, 10:02:35 am
Nice job leandro  smiley-wink

what type of motors are you using ??
375  Forum 2005-2010 (read only) / Exhibition / Re: Self Balancing Robot on: November 28, 2008, 06:55:01 am

I have build a balancing robot based on Sparkfun 5DOF acc/gyro combo, Arduino and Parallax continuous servo.
I had sofar mixed results and suspect the servos have to much backslash

I want to test the AX12 route.
Can you point me to some Arduino code to run these specific servos  :smiley


The "looseness" you describe is a real problem with balancers.  I used motors similar to yours at first, but was able to achieve much tighter and more responsive balancing by switching to zero-backlash servos (Dynamixel AX-12).

Here's a little sample movie of what a difference reduced backlash makes: ....

That demo is using the "encoder" (continuous rotation pot) integrated into the AX-12.

A friend of mine worked on a commercial balancing toy.  He mentioned that it used cheap high-backlash motors, and they had to use sophisticated filtering and modeling to accommodate the backlash.  It took an experienced control expert quite a while to get it working.

So I'll just stick with tighter motors.  

- Nathan
Pages: 1 ... 23 24 [25] 26