Walker BondNick BerloIan Sullivan
Published

MEGR 3171: Li-Po Battery Testing

This project consists of 3 particle argons communicating via webhooks to collect battery testing data for Li-Po battery cells.

IntermediateShowcase (no instructions)Over 1 day54
MEGR 3171: Li-Po Battery Testing

Things used in this project

Hardware components

Argon
Particle Argon
×3
Toggle Switch, Toggle
Toggle Switch, Toggle
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Current Sensor, ASEK772ECB-200B-T-DK
×1
Voltage Sensor
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
ThingSpeak API
ThingSpeak API

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Multitool, Screwdriver
Multitool, Screwdriver

Story

Read more

Schematics

Argon Schematic - Group 16

This image shows the wiring schematic for the 3 Argons used to collect data during this project. It shows the sensors used, how they are connected to the battery testing circuit, and how they interface with the Argons.

Code

Toggle Switch Code

Arduino
This is the code flashed on to the Argon with a toggle switch sensor, the first one in the chain of communication. The purpose is to send data via a webhook using the Particle.publish command when the toggle switch is "ON". The LED on the Argon will turn on for two seconds to indicate the data has been sent.
int ToggleSwitch = D0;      // Defines Toggle Switch sensor pin
const pin_t LED = D7;     // Defines LED pin

void setup() 
{
    pinMode(ToggleSwitch, INPUT_PULLDOWN);       // Configure ToggleSwitch as an input with a pullup resistor
    pinMode(LED, OUTPUT);       // Configure LED as an output
    
    Particle.subscribe("hook-response/Current Sensor", myHandler, MY_DEVICES);       // Subscribe to the integration response event
}

void myHandler(const char *event, const char *Current)        // Handle the integration response
{
        digitalWrite(LED,HIGH);      // Turns on the LED
        delay(5000);                // Delay 5 seconds
        digitalWrite(LED,LOW);       // Turns off the LED
}
 
void loop() 
{
    if(digitalRead(ToggleSwitch) == 1)      // Read the switch connected to D0
    {
        String Toggle = String(1);     // Data collected when the toggle switch is "ON"
        
        Particle.publish("Toggle Switch", Toggle, PUBLIC);        // Triggers the webhook
        
        digitalWrite(LED,HIGH);      // Turns on the LED
        delay(2000);                // Delay 2 seconds
        digitalWrite(LED,LOW);       // Turns off the LED
        delay(1000);                // Delay 1 second
        digitalWrite(LED,HIGH);      // Turns on the LED
        delay(2000);                // Delay 2 seconds
        digitalWrite(LED,LOW);       // Turns off the LED
        delay(5000);                // Delays 5 seconds
        
        ToggleSwitch = 0;       // Sets the ToggleSwitch value to 0
    }
}

Current Sensor Code

Arduino
This is the code flashed on to the second Argon in the chain of communication. This code receives data from the first Argon via a webhook using the Particle.subscribe function. Once this code sees a message from the first Argon, it starts to look for current values. If a certain value is measured, the particle sends a Particle.publish message via a webhook. To indicate that the data has been sent successfully, the LED on the Argon will turn on for two seconds.
int CurrentSensorRef = A0;      // Current sensor ref pin
const pin_t LED = D7;     // Defines LED pin

void setup() 
{
    pinMode(CurrentSensorRef, OUTPUT);     // Configure CurrentSensorRef as in output
    pinMode(LED, OUTPUT);       // Configure LED as an output

    Particle.subscribe("hook-response/Toggle Switch", myHandler, MY_DEVICES);       // Subscribe to the integration response event
}

void myHandler(const char *event, const char *Toggle)     // Handle the integration response
{
        digitalWrite(LED,HIGH);      // Turns on the LED
        delay(5000);                // Delay 5 seconds
        digitalWrite(LED,LOW);       // Turns off the LED
}
 
void loop() 
{
    if(analogRead(CurrentSensorRef) > 0.1)       // Read the current value connected to A0
    {
        String Current = String(100.42*(CurrentSensorRef)-251.37);     // Data collected when the a current value is detected
        
        Particle.publish("Current Sensor", Current, PUBLIC);       // Triggers the webhook
    
        digitalWrite(LED,HIGH);      // Turns on the LED
        delay(2000);                // Delay 2 seconds
        digitalWrite(LED,LOW);       // Turns off the LED
        delay(1000);                // Delay 1 second
        digitalWrite(LED,HIGH);      // Turns on the LED
        delay(2000);                // Delay 2 seconds
        digitalWrite(LED,LOW);       // Turns off the LED
        delay(5000);                // Delay 5 seconds
    
        CurrentSensorRef = 0;       // Sets the CurretnSensorRef value to 0
    }
}

Voltage Sensor Code

Arduino
This is the code flashed on to the last Argon in the chain of communication. This code begins by looking for a published message via a webhook from the current data. Once this message is received, the Argon begins to search for a voltage value. If the voltage value measured is above a certain threshold, the Argon will send a message via a webhook using the Particle.publish command. The LED light on the Argon will turn on for two seconds, then off when this command has been completed.
int VoltageSensorRef = A0;      // Voltage sensor ref pin
const pin_t LED = D7;     // Defines LED pin

void setup() 
{
    pinMode(VoltageSensorRef, OUTPUT);     // Configure VoltageSensorRef as in output
    pinMode(LED, OUTPUT);       // Configure LED as an output

    Particle.subscribe("hook-response/Current Sensor", myHandler, MY_DEVICES);       // Subscribe to the integration response event
}

void myHandler(const char *event, const char *Current)        // Handle the integration response
{
        digitalWrite(LED,HIGH);      // Turns on the LED
        delay(5000);                // Delay 5 seconds
        digitalWrite(LED,LOW);       // Turns off the LED
}
 
void loop() 
{
    if(analogRead(VoltageSensorRef) >= 0.1)       // Read the voltage value connected to A0
    {
        String Voltage = String(VoltageSensorRef*4);     // Data collected when the a voltage value is detected
        
        Particle.publish("Voltage Sensor", Voltage, PUBLIC);       // Triggers the webhook
    
        digitalWrite(LED,HIGH);      // Turns on the LED
        delay(2000);                // Delay 2 seconds
        digitalWrite(LED,LOW);       // Turns off the LED
        delay(1000);                // Delay 1 second
        digitalWrite(LED,HIGH);      // Turns on the LED
        delay(2000);                // Delay 2 seconds
        digitalWrite(LED,LOW);       // Turns off the LED
        delay(5000);                // Delays 5 seconds 
    
        VoltageSensorRef = 0;       // Sets the Voltage Sensor Ref value to 0
    }
}

Credits

Walker Bond

Walker Bond

1 project • 0 followers
Nick Berlo

Nick Berlo

0 projects • 0 followers
Ian Sullivan

Ian Sullivan

0 projects • 1 follower

Comments

Add projectSign up / Login