Battery Level - ADS1015 or Arduino

General GBZ-related chat goes here. Share ideas, tips and tricks, or ask questions that don't fit into the hardware/software help forums.
Post Reply
User avatar
amee
Posts: 5
Joined: Sun Nov 11, 2018 8:05 am
Has thanked: 2 times

Battery Level - ADS1015 or Arduino

Post by amee » Tue Jan 15, 2019 2:02 am

Hi All,

Please help to clarify -

Do i need an ADS 1015 if i'm using Arduino Pro Micro for my button Controls and have an Serial output from Arduino ( with connection from battery to arduino analog in) ?

User avatar
tinkerBOY
Posts: 710
Joined: Tue May 30, 2017 4:00 am
Has thanked: 294 times
Been thanked: 206 times

Re: Battery Level - ADS1015 or Arduino

Post by tinkerBOY » Tue Jan 15, 2019 2:28 am

The atmega32u4 chip on the Pro Micro already has the built-in 10-bit ADC so you don't need an ADS1015 for battery monitoring.
New! tinkerBOY PowerSwitch v1.0 with Safe Shutdown
Game Boy Zero Controllers available @ tinkerBOY.xyz * Support
tinkerBOY Controller v3.0 - built-in usb controller, usb audio, and usb hub
tinkerBOY Controller v2.0 - GPIO buttons and builtin PWM Audio and Amplifier
tinkerBOY Controller v1.1 - simple pcb button
* DPI Adapter - better display for GBZ
* keyboard converters - IBM XT/AT Soarer's Converter | ADB to USB Converter

lightpixel
Posts: 47
Joined: Tue Nov 21, 2017 4:50 am
Has thanked: 8 times
Been thanked: 32 times

Re: Battery Level - ADS1015 or Arduino

Post by lightpixel » Fri Mar 22, 2019 2:19 am

Can you please show me, how it´s working? Do I need a special arduino code or is it work "out of the box"?

User avatar
tinkerBOY
Posts: 710
Joined: Tue May 30, 2017 4:00 am
Has thanked: 294 times
Been thanked: 206 times

Re: Battery Level - ADS1015 or Arduino

Post by tinkerBOY » Fri Mar 22, 2019 2:30 am

lightpixel wrote:
Fri Mar 22, 2019 2:19 am
Can you please show me, how it´s working? Do I need a special arduino code or is it work "out of the box"?
You need of course a battery monitor code on both the arduino chip and on the Raspberry Pi side.

Here's a sample code from the Arduino IDE:

Code: Select all

/*
  ReadAnalogVoltage

  Reads an analog input on pin 0, converts it to voltage, and prints the result to the Serial Monitor.
  Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu).
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/ReadAnalogVoltage
*/

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5.0 / 1023.0);
  // print out the value you read:
  Serial.println(voltage);
}
New! tinkerBOY PowerSwitch v1.0 with Safe Shutdown
Game Boy Zero Controllers available @ tinkerBOY.xyz * Support
tinkerBOY Controller v3.0 - built-in usb controller, usb audio, and usb hub
tinkerBOY Controller v2.0 - GPIO buttons and builtin PWM Audio and Amplifier
tinkerBOY Controller v1.1 - simple pcb button
* DPI Adapter - better display for GBZ
* keyboard converters - IBM XT/AT Soarer's Converter | ADB to USB Converter

lightpixel
Posts: 47
Joined: Tue Nov 21, 2017 4:50 am
Has thanked: 8 times
Been thanked: 32 times

Re: Battery Level - ADS1015 or Arduino

Post by lightpixel » Fri Mar 22, 2019 3:09 am

Oh great. thank you. I want to use the mintybatterymonitor. So the battery is connected to GND and RAW on the arduino mirco board. Where has to wire SLC and SDA coming from the PI?

User avatar
infinitLoop
Posts: 536
Joined: Mon Dec 24, 2018 11:46 am
Location: Portland, OR
Has thanked: 222 times
Been thanked: 199 times
Contact:

Re: Battery Level - ADS1015 or Arduino

Post by infinitLoop » Mon Mar 25, 2019 4:29 pm

lightpixel wrote:
Fri Mar 22, 2019 3:09 am
Oh great. thank you. I want to use the mintybatterymonitor. So the battery is connected to GND and RAW on the arduino mirco board. Where has to wire SLC and SDA coming from the PI?
i believe the minty script is tailored to use the ads. if you want to use the onboard atmega one, i think you want to use hoolyhoo's gbzbatterymonitor instead. you should not need to connect the slc and sda as that is handled in the board (i think anyway - i haven't tried this on the tinkerboy board, but i've used another board with the built-in atmega controller as the monitor, and did not need to connect gpios for it to work)

check out this thread:

viewtopic.php?f=44&t=3537&hilit=pro+micro+for+battery

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest