Thread Tools
Jul 20, 2019, 02:58 PM
Registered User
vollrathd's Avatar
Thread OP

Minor Upgrades


I've beefed up the PCB circuit board where high currents are involved. The circuitry itself is not changed.

The Sketch firmware has been cleaned up a bit, and an option to allow measuring live current has been added by holding the push button switch closed for 10 seconds after power up.

Tried something new in this version. That feature adds a number of "Blocks" of dedicated "void XXXX(void) commands that are called by the very short main program system. Each block was designed, and checked, then converted to a "void my program (void). For me, this simplifies the organization of these Arduino Sketch software programs.

Here is the current Sketch for the milliampere hour meter / milliampere meter.

Code:
/* 
 ***************************************************************************************** 
 *  03/30/2019                                                                           *
 *  this program reads the MCP3424 A/D converter and sends the result to both the USB    *
 *  How it works
 *  The Arduino reads the MCP3424 every two milliseconds, and adds up the readout value
 *  When the readout value hits number 187, that represents exactly 5 milliampere hours.
 *  The sketch then updates an EErom field from 0x00 to 0XFF to represent that 5 mah, then
 *  increments the EErom address to the next location.  With 1024 EErom addresses, that 
 *  represents a maximum of 5 ma X 1000 or 5,000 Mah, sufficient for most RC use.
 *  Since the resolution is fixed at 5 mah increments, the unit will update its display 
 *  only after each 5 mah increment.  So, 24 eerom "0x00" equals 120 mah
 *  NOTE: CAN NOT USE INTERRUPT WITH MCP3424, THIS UNIT ALSO USES INTERRUPTS
 *  A switch is provided to allow resetting the unit for the beginning of the flying day
 *  Note that the full current range can easily be changed by different gain on the 
 *  MCP3424, or different shunts on the current sensing resistor
 *  07/19/2019  Added ability to read continuous current by holding momentary switch
 *  07/20/2019 
 *  Everything is working on the meter
 **** ref Gainx1, max input voltage is 2.5 VDC for full scale ****
 **** ref Gainx8, max input voltage is 0.25 VDC for full scale *** 
 **** ref SRxxB is bit resolution, ranging from 12 to 18 bits  *** 
 **** ref Gain X8 plus 18bits is 0.06 VDC for full scale *********
 **** MCP 3421 has one channel input 
 **** MCP 3422 has two channel inputs
 **** MCP 3424 has four channel inputs, from CH1 to Ch4
 **********************************************************************************
 */
 //initiate functions
#include <TimerOne.h>
#include <MCP3424.h>
#include <Wire.h>
#include <EEPROM.h>
#define OLED_RESET 4
#include <Adafruit_SH1106.h>
   Adafruit_SH1106 display(OLED_RESET); 
   MCP3424 adc(PIN_FLOAT, PIN_FLOAT);
   byte int_count=0;  //define variable
   int sensorPin = A7; 
   double  mah_value = 0;
   double mah_total = 0;
   unsigned int mah_hours = 0;
   byte flag;  //flag for interrupt
   float test = 0;
   int counter;
   byte value = 0;
   bool blocking = false;                        //allows for repeating read commands
//****************  Setup Routines **************************************************  
void setup()
//****************  Setup Routines **************************************************   
{
   pinMode(12, INPUT);  //used for oscilloscope timing
   pinMode(13, OUTPUT);   //used for reset EEprom on power up
   display.begin(SH1106_SWITCHCAPVCC,0x3C);//initialize 128/64 with the I2C addr 0x3C 
   Serial.begin(9600);
   display.clearDisplay();
   pinMode(LED_BUILTIN, OUTPUT);
   display.clearDisplay();                  //Set the display up, text size and color
   display.setTextSize(2); 
   display.setTextColor(WHITE);
//MCP3424 setup
   adc.generalCall(GC_RESET);
   adc.startNewConversion(CH4);
adc.startNewConversion(CH2);
   adc.creg[CH1].bits = {GAINx8, SR12B, CONTINUOUS, CH1, 1 };                  //Amps
   adc.creg[CH2].bits = {GAINx8, SR18B, CONTINUOUS, CH2, 1 };            //Volts 1&16
   adc.creg[CH3].bits = {GAINx4, SR18B, CONTINUOUS, CH3, 1 };//0.126 Volts Max X4 18B
   adc.creg[CH4].bits = {GAINx8, SR18B, CONTINUOUS, CH4, 1 };        //0.06 Volts max  
   display.clearDisplay();                      
   display.setTextSize(4);
   display.setTextColor(WHITE);
 } 
//********************************************************************************** 
 void Clear_EErom(void)   //this command clears the EErom to "FF's" if active button
{ digitalWrite(13, LOW);
  if (test == 0)                               //test if switch pushed to zero EErom
   {
   display.clearDisplay();   
   display.setTextSize(4);
   display.setCursor(0,00);
   display.print("Reset");
   display.display(); 
   delay(1000);
 for (counter = 0 ; counter < 1000 ; counter++)           //preset EErom to all FF's
  {
   EEPROM.write(counter, 0XFF);
  }
 }
   display.clearDisplay();   
   digitalWrite(13, HIGH);   
   display.clearDisplay();                               //delay for time to read it
   display.setCursor(0,0); 
   display.print("Start");
   display.display();
   delay (1000);
 }
//********************************************************************************** 
  void Read_EErom(void)  //this command allows dumping EErom to USB port for testing
{
  mah_hours = 0;
 for (counter =0; counter<1000;counter++) 
  {
   value = EEPROM.read(counter);
   Serial.println(value, DEC);
  } 
}
//********************************************************************************** 
void Retrieve_mah(void)       //routine scans EErom, adding up mah hours on each "0"
{
   mah_hours = 0;
 for (counter =0; counter<1000;counter++) 
  {
   value = EEPROM.read(counter);
  if (value == 0)
   {
    mah_hours = counter;                      //adds 5 mah per 'zero', stops at 1000
   }
  } 
   display.clearDisplay();                   //display accumulated milliampere hours                     
   display.setCursor(0,0); 
   display.print(mah_hours*5); //its 5 mah per EEprom memory location filled with "0"
}
//*********************************************************************************** 
void Get_mah(void)
//** this command reads A/D, and upgrades EErom from FF to 00 every 5 MilliAmpere Hrs 
{ 
 for (counter = 0;counter<1000;counter++)     //read MCP3424 1000 times in 0.7 seconds
 {
 //   digitalWrite(12, HIGH);                      // turn the LED on (scope monitor)
   ConvStatus err = adc.read(CH2, mah_value,blocking);   
   mah_total = mah_total+mah_value;  //add up total mah counts
 if (mah_total>290)                                 //number 290 equals exactly 5 mah 
  {
   mah_hours = mah_hours+1;
   mah_total = 0;
   EEPROM.write(mah_hours, 0X00);
   display.clearDisplay();                      
   display.setCursor(0,20);
   display.print(mah_hours*5); 
   display.display();
  }
 }  
}
//*********************************************************************************** 
void Read_Ma(void)     //this routine is an endless read current routine initiated by 
                                                          //holding pushbotton closed
{
    display.clearDisplay();
    display.setCursor(0,20); 
    display.print("MAH!");
    display.display();
    delay(2000);
    for(;;)
 {
    ConvStatus err = adc.read(CH2, mah_value,blocking); 
    display.setTextSize(4);
    display.clearDisplay();
    display.setCursor(0,00); 
    mah_value = mah_value*93300 ;
    mah_value = mah_value;
    display.print(mah_value,0);
    display.setCursor(0,40); 
    display.setTextSize(3);
    display.print("MillAmp");
    display.display();  
    delay(1000);
 }
}
//*********************************************************************************** 
//        this is an endless "OVER" flag to show the EErom 1000 bytes is over written
void Over_Run(void)
{
 for(;;)
 {
   display.clearDisplay();
   display.setCursor(0,20); 
   display.print("OVER");
   display.display();
   delay(300);
   display.clearDisplay();
   display.setCursor(0,20); 
   display.print("    ");
   display.display();
   delay(100);
 }
}
//**********************************************************************************    
//Main program                         //this is the main loop of the control sketch
void loop()
{ 
    display.setTextSize(5);
    digitalWrite (12,HIGH);                        //turn on pull up resistor on D12
 if(digitalRead(12) == LOW)           //test for key push if key pushed, reset EErom
  {
   Clear_EErom(); 
  }
   display.clearDisplay();
   display.print("Do ma?");
   delay(2000);
 if(digitalRead(12) == LOW)    //test for key push if key still pushed, read live ma
  {
    Read_Ma(); 
   }
   Retrieve_mah();      //call to retrieve accumulated milliampere hours for the day
   display.clearDisplay();
   display.setCursor(0,20); 
   display.print(mah_hours*5 ); 
   display.display();
// go into endless loop for mah capacity
  for(;;)                                                             //endless loop
  {
   Get_mah();                         //get every five milliampere hour accumulation
 if(mah_hours>1000)               //if EErom over run of 5000 mah, flag OLED display
  {
    Over_Run();
  }
 } 
}

 
//********  End of Sketch Program***************************************************
Last edited by vollrathd; Jul 20, 2019 at 03:21 PM.
Sign up now
to remove ads between posts
Jul 21, 2019, 07:25 PM
Registered User
vollrathd's Avatar
Thread OP
Quote:
Originally Posted by Jim.Thompson
PM sent.
Hi Jim
I've been checking on the United States Postal Service charge to ship a couple of the circuit boards to Australia. The shipping price comes to just over $40.00 ten times what the circuit boards are worth. But the circuitry is simple enough that it could be wired up on one of those perf board bread boards, available through Ebay and other locations.

Dang.
Jul 21, 2019, 11:46 PM
Entropy is happening!
Jim.Thompson's Avatar
Quote:
Originally Posted by vollrathd
Hi Jim
I've been checking on the United States Postal Service charge to ship a couple of the circuit boards to Australia. The shipping price comes to just over $40.00 ten times what the circuit boards are worth. But the circuitry is simple enough that it could be wired up on one of those perf board bread boards, available through Ebay and other locations.

Dang.
That is in line with what I have been quoted for other consignment from the US to Australia.
I'm glad you did not pay that exhorbitant fee.
I am happy to make up small circuits like this using perforated boards, as you suggest.
To wit: my "Voltsagger" devices...........all done this way.

Thanks,

Jim.
Jul 22, 2019, 12:07 AM
Registered User
vollrathd's Avatar
Thread OP
Quote:
Originally Posted by Jim.Thompson
That is in line with what I have been quoted for other consignment from the US to Australia.
I'm glad you did not pay that exhorbitant fee.
I am happy to make up small circuits like this using perforated boards, as you suggest.
To wit: my "Voltsagger" devices...........all done this way.

Thanks,

Jim.
Hi Jim
I'm going to try to mail one of the PCB's in a standard letter to you tomorrow with regular international mail service. We'll see what that costs. If it's only a few dollars, I'll just send it out.

A couple of years ago, I sent a small package to South America. The USPS charge for that was only $12.00 USA.
Jul 23, 2019, 12:32 AM
Registered User
vollrathd's Avatar
Thread OP
Quote:
Originally Posted by Jim.Thompson
That is in line with what I have been quoted for other consignment from the US to Australia.
I'm glad you did not pay that exhorbitant fee.
I am happy to make up small circuits like this using perforated boards, as you suggest.
To wit: my "Voltsagger" devices...........all done this way.

Thanks,

Jim.
Hi Jim
Postage was only $1.10 USA via long business envelope, so I mailed it today. Hopefully you will get it in a week or so.
Jul 23, 2019, 04:29 AM
Entropy is happening!
Jim.Thompson's Avatar
Quote:
Originally Posted by vollrathd
Hi Jim
Postage was only $1.10 USA via long business envelope, so I mailed it today. Hopefully you will get it in a week or so.
Many thanks..................

I will probably not get around to making one up until after our annual slope festival in September. I have lots of building and preparation work on models to do before then.

Jim.
Jul 27, 2019, 07:43 PM
Registered User
vollrathd's Avatar
Thread OP

The MAH meter is done!


I"ve built up three of these units so far. And, ran into a little variation in accuracy of two or three percent between those units. The meters had to be tweaked in the Arduino Sketch program to bring them up to better than 1% accuracy. With a bit of investigation, that variation was traced to the PCB board layout. The problem resulted where the Analog Digital converter was connected to the 0.01 Ohm 1% resistor. The PCB layout involved with the 0.01 Ohm resistor included about 0.05 inches of PCB foil, increasing the resistance as seen by the A/D converter by the resistance of that copper foil pattern.

So, I just soldered the two negative black servo lead wires directly to the 0.01 Ohm resistors. Problem solved.

Find attached a couple of photos of the finished unit as installed in a 3D printed case. As configured, the unit weighs exactly one ounce, with about half of that weight due to the 3D printed case. The case measures 2 inches by 1 by 1 inch.

I've included the ability to measure the live current pulled by the receiver and its servos. That is accomplished by pushing and holding the reset switch before switching on the receiver battery. Then hold that switch closed for ten seconds after the unit is powered up.
Jul 27, 2019, 07:48 PM
Registered User
vollrathd's Avatar
Thread OP

MAH meter Arduino Sketch program


Here is the Arduino Sketch software.

Code:
/* 
 ***************************************************************************************** 
 *  03/30/2019                                                                           *
 *  this program reads the MCP3424 A/D converter and sends the result to both the USB    *
*  The PCB layout includes foil patterns to allow using the three extra A/D channels for other use.
 *  How it works
 *  The Arduino reads the MCP3424 every two milliseconds, and adds up the readout value
 *  When the readout value hits number 241, that represents exactly 5 milliampere hours.
 *  The sketch then updates an EErom field from 0x00 to 0XFF to represent that 5 mah, then
 *  increments the EErom address to the next location.  With 1024 EErom addresses, that 
 *  represents a maximum of 5 ma X 1000 or 5,000 Mah, sufficient for most RC use.
 *  Since the resolution is fixed at 5 mah increments, the unit will update its display 
 *  only after each 5 mah increment.  So, 24 eerom "0x00" equals 120 mah
 *  NOTE: CAN NOT USE INTERRUPT WITH MCP3424, THIS UNIT ALSO USES INTERRUPTS
 *  A switch is provided to allow resetting the unit for the beginning of the flying day
 *  Note that the full current range can easily be changed by different gain on the 
 *  MCP3424, or different shunts on the current sensing resistor
 *  07/19/2019  Added ability to read continuous current by holding momentary switch
 *  07/20/2019 
 *  Everything is working on the meter
 **** ref Gainx1, max input voltage is 2.5 VDC for full scale ****
 **** ref Gainx8, max input voltage is 0.25 VDC for full scale *** 
 **** ref Gainx8, 18 Bits, max input voltage is 0.06 VDC for full scale *** 
 **** ref SRxxB is bit resolution, ranging from 12 to 18 bits  *** 
 **** ref Gain X8 plus 18bits is 0.06 VDC for full scale *********
 **** MCP 3421 has one channel input 
 **** MCP 3422 has two channel inputs
 **** MCP 3424 has four channel inputs, from CH1 to Ch4
 **********************************************************************************
 */
 //initiate functions
#include <TimerOne.h>
#include <MCP3424.h>
#include <Wire.h>
#include <EEPROM.h>
#define OLED_RESET 4
#include <Adafruit_SH1106.h>
   Adafruit_SH1106 display(OLED_RESET); 
   MCP3424 adc(PIN_FLOAT, PIN_FLOAT);
   byte int_count=0;  //define variable
   int sensorPin = A7; 
   double  mah_value = 0;
   double mah_total = 0;
   unsigned int mah_hours = 0;
   byte flag;  //flag for interrupt
   float test = 0;
   int counter;
   byte value = 0;
   bool blocking = false;                        //allows for repeating read commands
//****************  Setup Routines **************************************************  
void setup()
//****************  Setup Routines **************************************************   
{
   pinMode(12, INPUT);  //used for oscilloscope timing
   pinMode(13, OUTPUT);   //used for reset EEprom on power up
   display.begin(SH1106_SWITCHCAPVCC,0x3C);//initialize 128/64 with the I2C addr 0x3C 
   Serial.begin(9600);
   display.clearDisplay();
   pinMode(LED_BUILTIN, OUTPUT);
   display.clearDisplay();                  //Set the display up, text size and color
   display.setTextSize(2); 
   display.setTextColor(WHITE);
//MCP3424 setup
   adc.generalCall(GC_RESET);
   adc.startNewConversion(CH4);
adc.startNewConversion(CH2);
   adc.creg[CH1].bits = {GAINx8, SR12B, CONTINUOUS, CH1, 1 };                  //Amps
   adc.creg[CH2].bits = {GAINx8, SR18B, CONTINUOUS, CH2, 1 };            //Volts 1&16
   adc.creg[CH3].bits = {GAINx4, SR18B, CONTINUOUS, CH3, 1 };//0.126 Volts Max X4 18B
   adc.creg[CH4].bits = {GAINx8, SR18B, CONTINUOUS, CH4, 1 };        //0.06 Volts max  
   display.clearDisplay();                      
   display.setTextSize(4);
   display.setTextColor(WHITE);
 } 
//********************************************************************************** 
 void Clear_EErom(void)   //this command clears the EErom to "FF's" if active button
{ digitalWrite(13, LOW);
  if (test == 0)                               //test if switch pushed to zero EErom
   {
   display.clearDisplay();   
   display.setTextSize(3);
   display.setCursor(0,00);
   display.print("Reset");
    display.setCursor(0,30);
   display.print("Hold Ma");
   display.display(); 
   delay(1000);
 for (counter = 0 ; counter < 1000 ; counter++)           //preset EErom to all FF's
  {
   EEPROM.write(counter, 0XFF);
  }
 }
   display.clearDisplay();   
   digitalWrite(13, HIGH);   
   display.clearDisplay();                               //delay for time to read it
   display.setCursor(0,0); 
   display.print("New Run");
     display.setCursor(0,30); 
   display.print("SW Off!");
   display.display();
   delay (2000);
 }
//********************************************************************************** 
  void Read_EErom(void)  //this command allows dumping EErom to USB port for testing
{
  mah_hours = 0;
 for (counter =0; counter<1000;counter++) 
  {
   value = EEPROM.read(counter);
   Serial.println(value, DEC);
  } 
}
//********************************************************************************** 
void Retrieve_mah(void)       //routine scans EErom, adding up mah hours on each "0"
{
   mah_hours = 0;
 for (counter =0; counter<1000;counter++) 
  {
   value = EEPROM.read(counter);
  if (value == 0)
   {
    mah_hours = counter;                      //adds 5 mah per 'zero', stops at 1000
   }
  } 
   display.clearDisplay();                   //display accumulated milliampere hours                     
   display.setCursor(0,0); 
   display.print(mah_hours*5); //its 5 mah per EEprom memory location filled with "0"
}
//*********************************************************************************** 
void Get_mah(void)
//** this command reads A/D, and upgrades EErom from FF to 00 every 5 MilliAmpere Hrs 
{ 
    display.setTextSize(2);
    display.setCursor(110,0);
    display.print("M"); 
    display.setCursor(110,25);
    display.print("A"); 
    display.setCursor(110,50);
    display.print("H"); 
    display.display();
   for (counter = 0;counter<1000;counter++)     //read MCP3424 1000 times in 0.7 seconds
 {
 //   digitalWrite(12, HIGH);                      // turn the LED on (scope monitor)
    ConvStatus err = adc.read(CH2, mah_value,blocking);   

   
   mah_total = mah_total+mah_value;  //add up total mah counts

 //   Serial.println(mah_total, 6);
 if (mah_total>241)                                 //number 241equals exactly 5 mah 
  {
   mah_hours = mah_hours+1;
   mah_total = 0;
   EEPROM.write(mah_hours, 0X00);
    display.setTextSize(4);
    display.clearDisplay();                      
    display.setCursor(0,20);
    display.print(mah_hours*5); 
    display.setTextSize(3);
    display.setCursor(80,0);
    display.setTextSize(2);
    display.setCursor(110,0);
    display.print("M"); 
    display.setCursor(110,25);
    display.print("A"); 
    display.setCursor(110,50);
    display.print("H"); 
    display.display();
  }
 }  
}
//*********************************************************************************** 
void Read_Ma(void)     //this routine is an endless read current routine initiated by 
                                                          //holding pushbotton closed
{
    display.clearDisplay();
    display.setCursor(0,20); 
    display.print("MAH!");
    display.display();
    delay(2000);
    for(;;)
 {
   ConvStatus err1 = adc.read(CH2, mah_value,blocking); 
    Serial.println(mah_value, 6);
    display.setTextSize(4);
    display.clearDisplay();
    display.setCursor(0,00); 
    mah_value = mah_value*109300 ;
    mah_value = mah_value+1;
  
    display.print(mah_value,0);
    display.setCursor(0,45); 
    display.setTextSize(3);
    display.print("MillAmp");
    display.display();  
    delay(1000);
 }
}
//*********************************************************************************** 
//        this is an endless "OVER" flag to show the EErom 1000 bytes is over written
void Over_Run(void)
{
 for(;;)
 {
   display.clearDisplay();
   display.setCursor(0,20); 
   display.print("OVER");
   display.display();
   delay(300);
   display.clearDisplay();
   display.setCursor(0,20); 
   display.print("    ");
   display.display();
   delay(100);
 }
}
//**********************************************************************************    
//Main program                         //this is the main loop of the control sketch
void loop()
{ 
    display.setTextSize(5);
    digitalWrite (12,HIGH);                        //turn on pull up resistor on D12
 if(digitalRead(12) == LOW)           //test for key push if key pushed, reset EErom
  {
   Clear_EErom(); 
  }
   display.clearDisplay();
   display.print("Do ma?");
   delay(2000);
 if(digitalRead(12) == LOW)    //test for key push if key still pushed, read live ma
  {
    Read_Ma(); 
   }
   Retrieve_mah();      //call to retrieve accumulated milliampere hours for the day
   display.clearDisplay();
   display.setCursor(0,20); 
   display.print(mah_hours*5 ); 
   display.display();
// go into endless loop for mah capacity
  for(;;)                                                             //endless loop
  {
   Get_mah();                         //get every five milliampere hour accumulation
 if(mah_hours>1000)               //if EErom over run of 5000 mah, flag OLED display
  {
    Over_Run();
  }
 } 
}

 
//********  End of Sketch Program***************************************************
Jul 27, 2019, 09:16 PM
Entropy is happening!
Jim.Thompson's Avatar

Marvellous!


Great little unit you have developed here Volrathd; and thanks for publishing all the details including the code for some of us less arduin savvy (wannabe savvy) users!
I will be making my first one up in October.
Jul 27, 2019, 11:50 PM
Registered User
vollrathd's Avatar
Thread OP

Little History!


Quote:
Originally Posted by Jim.Thompson
Great little unit you have developed here Volrathd; and thanks for publishing all the details including the code for some of us less arduin savvy (wannabe savvy) users!
I will be making my first one up in October.
Yeah, I started working with microprocessors back in the 1980's, actually designed and built up a very simple word processor system with 500 feet of wire wrapping, 70 IC's, keyboard and so on. It used a small black and white TV for a monitor. Today that whole project could be replaced by a single high performance MicroChip PicChip.

That was all machine code back then. In 2015, I decided to purchase that mikroC "C" software for PicChips, at a $200.00 cost, plus another $100.00 for the corresponding programmer. Learned a lot on that "C" language, problem is, a good 50% of my programming time was spent diagnosing problems that were traced back to many many software bugs in the $200.00 mikroC software. That includes spending days troubleshooting mikroC bugs during my "BattIR" project. One of the last bugs was finding out that the latest mikroC software cause the PicChip to quit working while writing to the EErom on the PicChip.

Two years ago, bit the bullet, and purchased a couple of those Arduino Nano's. They have good and bad features. The good, they are much easier to use, programming is far less involved than that microC process. And, there are endless books on the Arduino system (I've got 5 of them), along with endless information in the internet. And, IMHO, for anyone wanting to play with microcontrollers, those Arduino's are very hard to beat. And, they go for around $3.50 each on Ebay. So, a person can literally get started with those Arduino's for less than the cost of a lunch at McDonalds.

Bad news? One, is they pull a lot of current, versus those MicroChips. A typical MicroChip when their internal clock is slowed down, can pull less than one milliampere, making battery powered units very useable. On the other hand, those Arduino's I've played with pull some 20 milliamperes, making power by one of those 9 volt batteries very limited.

One book I just got today does describe how to slow the Arduino Clock down to reduce current drain, will have to check that out.
Last edited by vollrathd; Jul 28, 2019 at 06:38 AM.
Jul 28, 2019, 08:06 AM
Registered User
I too use Arduino for lots of projects. IMO the limiting factor is the 8 bit 16MHz processor. Now you can get boards with much faster more capable processors that still can be programmed with the Arduino IDE. I have not used many of them yet but I did get an ESP32 board to fool with. It has Wifi and Bluetooth on it. So far I have not done any internet connected projects either but I want to try it. Most of my projects involve battery charging, management, discharge. My most complex one is a BMS for my Leaf battery powered golf cart. It has 14 cells which presented some challenges to measure cell voltages accurately. This project includes a speedometer, odometer, overcharge protection, cell voltage readings to the mV, Time, Date, and Ambient and Motor temperatures. I use a 16 x 4 display but I would like to convert to a graphics display like the Nextion.
Jul 28, 2019, 01:38 PM
Registered User
Quote:
Originally Posted by Jim.Thompson
That is in line with what I have been quoted for other consignment from the US to Australia.
I'm glad you did not pay that exhorbitant fee.
I am happy to make up small circuits like this using perforated boards, as you suggest.
To wit: my "Voltsagger" devices...........all done this way.

Thanks,

Jim.
Just in case, for a future need///

Oshpark ships for free to most countries https://docs.oshpark.com/submitting-...g-information/. Their quality is very high, and turnaround relatively quick
Jul 28, 2019, 01:45 PM
Registered User
Quote:
Originally Posted by vollrathd
Yeah, I started working with microprocessors back in the 1980's, actually designed and built up a very simple word processor system with 500 feet of wire wrapping, 70 IC's, keyboard and so on. It used a small black and white TV for a monitor. Today that whole project could be replaced by a single high performance MicroChip PicChip.

That was all machine code back then. In 2015, I decided to purchase that mikroC "C" software for PicChips, at a $200.00 cost, plus another $100.00 for the corresponding programmer. Learned a lot on that "C" language, problem is, a good 50% of my programming time was spent diagnosing problems that were traced back to many many software bugs in the $200.00 mikroC software. That includes spending days troubleshooting mikroC bugs during my "BattIR" project. One of the last bugs was finding out that the latest mikroC software cause the PicChip to quit working while writing to the EErom on the PicChip.

Two years ago, bit the bullet, and purchased a couple of those Arduino Nano's. They have good and bad features. The good, they are much easier to use, programming is far less involved than that microC process. And, there are endless books on the Arduino system (I've got 5 of them), along with endless information in the internet. And, IMHO, for anyone wanting to play with microcontrollers, those Arduino's are very hard to beat. And, they go for around $3.50 each on Ebay. So, a person can literally get started with those Arduino's for less than the cost of a lunch at McDonalds.

Bad news? One, is they pull a lot of current, versus those MicroChips. A typical MicroChip when their internal clock is slowed down, can pull less than one milliampere, making battery powered units very useable. On the other hand, those Arduino's I've played with pull some 20 milliamperes, making power by one of those 9 volt batteries very limited.

One book I just got today does describe how to slow the Arduino Clock down to reduce current drain, will have to check that out.
Most of the power usage of the cheap Arduino boards are due to the LDO used and the LEDs. If you search for "making arduino low power" you will find many articles like https://forum.arduino.cc/index.php?topic=418299.0. The processor in the original Arduinos has very, very low power usage, but the cheap Arduino boards were never optimized for low power

Also, don't forget that Arduino is an umbrella term for the development environment. You are not tied to the Atmega-based original Arduinos, and can get STM32, ESP8266, etc, each with different features and power requirement

There's no reason why an Arduino project should use more power than a PIC, if the board itself is properly designed and you use the low power mode when not requiring the full processing speed
Jul 28, 2019, 01:52 PM
Registered User
Quote:
Originally Posted by Volt_Ampere
I too use Arduino for lots of projects. IMO the limiting factor is the 8 bit 16MHz processor. Now you can get boards with much faster more capable processors that still can be programmed with the Arduino IDE. I have not used many of them yet but I did get an ESP32 board to fool with. It has Wifi and Bluetooth on it. So far I have not done any internet connected projects either but I want to try it. Most of my projects involve battery charging, management, discharge. My most complex one is a BMS for my Leaf battery powered golf cart. It has 14 cells which presented some challenges to measure cell voltages accurately. This project includes a speedometer, odometer, overcharge protection, cell voltage readings to the mV, Time, Date, and Ambient and Motor temperatures. I use a 16 x 4 display but I would like to convert to a graphics display like the Nextion.
If you don't need WiFi and Bluetooth, I highly recommend buying an STM32 "Blue Pill". ST now officially supports Arduino on their chips (https://github.com/stm32duino/Arduino_Core_STM32) and there's a highly technical community ready to help (https://stm32duino.com/ at the moment down, I think that they are migrating to the official ST servers)

ESP32 is awesome if you need Wifi or BLE, but the ADC section is very weak, compared to an STM32. Incidentally, most low cost digital oscilloscopes rely on the STM32 ADC with minimal circuitry. The STM32 has an amazing ADC, vastly superior to the Atmege one used in the original Arduino boards. And with Arduino on the STM32 family you can start with $2 Blue Pill boards and go all he way to a monster STM32H7, capable of more than 1300 MIPS at 480MHz clock, plus very advanced DSP functionality
Jul 29, 2019, 12:16 AM
Registered User
vollrathd's Avatar
Thread OP
Quote:
Originally Posted by robca
Most of the power usage of the cheap Arduino boards are due to the LDO used and the LEDs. If you search for "making arduino low power" you will find many articles like https://forum.arduino.cc/index.php?topic=418299.0. The processor in the original Arduinos has very, very low power usage, but the cheap Arduino boards were never optimized for low power

Also, don't forget that Arduino is an umbrella term for the development environment. You are not tied to the Atmega-based original Arduinos, and can get STM32, ESP8266, etc, each with different features and power requirement

There's no reason why an Arduino project should use more power than a PIC, if the board itself is properly designed and you use the low power mode when not requiring the full processing speed
I just checked on the power requirements of the Pic18F13K50 chip I've used in many projects over the years. When this device is running at 4 Mhz via its built in system clock, it pulls around a half milliampere. This device has a program selectable clock speed that can be as low as 32 Khz. At 32 Khz, it pulls around 10 microamperes.

The Arduino Nano along with the OLED in this project pulls 32 MilliAmperes, over 50 times more current than a comparable PicChip.

But, dang, those Arduino's are several orders of magnitude easier to use compared to those PicChips.


Quick Reply
Message:

Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Question Taranis X9D plus, X8R recvr, vario-- why is altitude spoken in "milliamp hours"? aeronaut999 Radios 4 Jan 05, 2017 12:17 AM
Help! Milliamp hours going crazy Hayvosh Eagle Tree Systems 6 Sep 22, 2012 01:56 AM
Discussion Higher milliamp hours = longer flying time? tritonfx Batteries and Chargers 12 Jun 27, 2009 03:15 PM
Where can I get a Milliamp Meter? mrebman Batteries and Chargers 1 Apr 24, 2004 11:35 AM
The milliamp-hour is a unit of... Miami Mike Batteries and Chargers 14 Feb 21, 2004 01:00 AM