Thursday, May 17, 2012

Hybrid Relay - Low voltage Disconnect

I needed a low voltage disconnect to disconnect my loads from the battery when the battery voltage drops below a predetermined level. This is a hybrid relay, as I put a MOSFET in parallel with the relay contacts. The Arduino turns on the MOSFET, then the relay. On shutdown, it deactivates the relay, then the MOSFET. This does two things:

1. Prevents arcing (welding) of the relay contacts
2. Prevents over heating of the MOSFET

This could also be used as a solar / wind dump load controller, turning on a water or air  heating element when the battery voltage exceeds maximum, and turning it off when the battery voltage returns to normal.

More details to come!

Saturday, May 5, 2012

Monday, April 30, 2012

Voltage Monitor

Now that we have the current monitor working, the next step is to build the voltage monitor circuit. I built a voltage divider that will break down the highest voltage my battery can possibly see, into a 0-5v input for the Arduino. Here is a great tutorial explaining the math behind determining the resister values, http://forums.trossenrobotics.com/tutorials/how-to-diy-128/cheap-battery-monitor-using-resistive-voltage-divider-3264/, and a schematic of our version:



Here is a screen shot of the monitor showing both current and voltage being monitored.


Now the trick is to multiply the current with the voltage to get watts.


The next step is to sample over time to display the amp hour and watt hour values. Still working on that. I've posted a spreadsheet for calculating the resistor values (and amp hour formulas) at http://tech.groups.yahoo.com/group/arduinohome/files/volt%20amp%20watt%20hour%20meter/

There's a good discussion of this project at http://forum.pololu.com/viewtopic.php?f=3&t=5415


Monitoring Power Consumption with the ACS715

We needed a power meter for monitoring power consumption of our ham radio's when in emergency communications mode (no grid). Although you can get these commercially, from the fully featured off grid power system capable Bogart Trimetric, to the single item Watt's UP, we wanted a diy homebrew unit that is educational, and customizable. Based on a ACS715 Hall Effect Current Sensor, connected to an Arduino, we are now monitoring the current consumption of our radio gear. The following screen shot shows both TX and RX power modes.
I'm posting the code below for the current monitor, and now I'm off to add voltage monitoring, and to calculate watts, watt hours, and amp hours.

 /* This sketch describes how to connect a ACS715 Current Sense Carrier (http://www.pololu.com/catalog/product/1186) to the Arduino, and read current flowing through the sensor.

Vcc on carrier board to Arduino +5v
GND on carrier board to Arduino GND
OUT on carrier board to Arduino A0

 Insert the power lugs into the loads positive lead circuit, arrow on carrier board points to load, other lug connects to power supply positive */

int analogInPin = A0; // Analog input pin that the carrier board OUT is connected to
int sensorValue = 0; // value read from the carrier board
int outputValue = 0; // output in milliamps

void setup() { // initialize serial communications at 9600 bps:
Serial.begin(9600); }

void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);

// convert to milli amps
outputValue = (((long)sensorValue * 5000 / 1024) - 500 ) * 1000 / 133;

 /* sensor outputs about 100 at rest. Analog read produces a value of 0-1023, equating to 0v to 5v. "((long)sensorValue * 5000 / 1024)" is the voltage on the sensor's output in millivolts. There's a 500mv offset to subtract. The unit produces 133mv per amp of current.*/

 // print the results to the serial monitor:
 Serial.print("sensor = " );
Serial.print(sensorValue);
Serial.print("\t Current (ma) = ");
Serial.println(outputValue);

 // wait 10 milliseconds before the next loop
 // for the analog-to-digital converter to settle // after the last reading:
 delay(10); }

Saturday, March 31, 2012

Gas Sensor Tutorial

We just received a bunch of Gas Sensors from Hacktronics. These sensors include:

MQ2 - Flammable Gas & Smoke
MQ3 - Alcohol
MQ4 - Methane
MQ6 - LPG / IsoButane / Propane
MQ7 - Carbon Monoxide
MQ9 - Carbon Monoxide & Flammable Gas

Today's project is a smoke detector that turns on an LED when smoke concentrations exceed a certain level.  We soldered the sensor to the carrier board, along with a sensitivity resistor and a 3 pin header. The carrier board pins are VCC (+5v), GND, and Out, which connects to A0 on our Arduino. We connected a LED to Pin 13 and Gnd as indication of an alarm state (smoke detected). See the video and the code we used:

Next step is a temp sensor for heat detection, and a relay for a siren.


// These constants won't change.  They're used to give names
// to the pins used:
const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to
const int ledPin = 13;                 // LED connected to digital pin 13

int sensorValue = 0;        // value read from the sensor




void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600); 
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);            
  // determine alarm status
  if (sensorValue >= 750)
  {
    digitalWrite(ledPin, HIGH);   // sets the LED on
  }
  else
  {
  digitalWrite(ledPin, LOW);    // sets the LED off
  }

  // print the results to the serial monitor:
  Serial.print("sensor = " );                       
  Serial.println(sensorValue);     

  // wait 10 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:
  delay(10);                     
}

Monday, March 19, 2012

Arduino to VGA

I've previously posted about our micrometer to VGA project, and wanted to post an updated picture of that finished project in production. It's a gear mic'ing station that takes 3 samples of a gear, rejects the gear if the samples are not close enough, and generates a bin number for the operator to put that gear into, for pump assembly (fuel oil pumps).


Download code and schematics.

The Arduino Thermostat

I've talked about this before, but since I just built another one last week, I thought I'd reshare this project, as it has a slight twist.

The idea is to select the temperature you want with a potentiometer, and display it on the screen. Then the Arduino reads a Dallas 18B20 digital temperature chip (or a thermocouple for higher temperature needs, like a temperature controlled soldering station) and controls a SSR (with a heater or A/C attached) to match the temperature requested. When the temperature chip reads the same as the requested temperature, then the power to the heating or cooling device is turned off.


This project has many applications, from room temperature control, to water heaters, or even environmental chambers. The concept is the same. With the addition of a RTC, you can easily program day night setbacks or even weekend setbacks. With a second temp sensor outdoors, you can add a offset based on outdoor temperature, i.e. increase indoor temperature by 5 F if outdoor is <30, and decrease indoor by 5 F if outdoor is >90.

I've covered some of these concepts before at Two DS18B20 Temp Sensors on LCD Display!

Most of the parts needed to make this unit are available at Hacktronics:
Arduino Uno
LCD Display
Dallas 18B20

10 amp 24-330vac load, 4-32vdc control (opto isolated) SSR

Download the two sketches, a low temp dallas chip version, and a high temp thermocouple version!