Idle Waste Alarm
A growing contradiction of the masses is concern for the environment while simultaneously being wasteful slobs. The belief that self matters veiled by an internet fog often perverts attention to atmospheric abuse and trivial consumption of resources that a human just 40 years ago would have milked for every drop.


One very aggravating all too frequent observation is the running-automobile-phone-user. A text or status update in your running parked car I would equate to treason. In reality, sheep and shepherd are the only true biological conditions of our species; so here is a first version shock blanket for your filthy habit.

Ideally, such a device may be wired and concealed, programmed by manufacturer (eh?!) or self prescribed to treat such a disability. In this particular model, an accelerometer affixed to an Arduino Nano reads variations of movement, accumulating time idling to a warning after 2 minutes, as to navigate around average traffic light pauses.

A pending model utilizing the Arduino MKR1000 stores the motion to idle ratio and warnings, then when near a known network, transmits the stored data to ThingSpeak for collection and analysis.



Research
Idle Fuel Consumption
0.6L/HR per Liter Engine Displacement

Sample
Toyota Camry 2.5L 4CYL (#1 U.S. Mid-sized Sedan)
2.5 x 0.6 = 1.5 / 60 = 0.025L/M

Idle Pollution
9 gram(s) of toxins (ex. CO2) per 1 minute

Walmart Locations
United States 4,540
International 6,301
Sam's Club 647

Calculation (Muted Prognosis)
10 Idle Texters per Day per U.S. Walmart Parking Lot
10 x 4,540 = 45,400

45,400 x 9 = 408,600 Grams (901 Pounds) of Pollutants per Minute
408,600 x 5 Minutes Texting = 2,043,000 Grams (4,504 Pounds)
408,600 x 20 Minutes = 8,172,000 Grams (18,016 Pounds)

45,400 x 0.025 = 1,135 Liters (299.8 Gallons) per Minute
1,135 x 5 Minutes Texting = 5,675 Liters (1,499 Gallons)
1,135 x 20 Minutes = 22,700 Liters (5,997 Gallons)



Arduino Sketch
// Idle Waste Alarm
// Vije Miller
// MPU-6050 Sketch JohnChi

#include "Wire.h"

// I2C address of the MPU-6050
const int MPU_addr = 0x68;
int16_t AcY;

// Sensitivity
int high = 2700;
int low = -2700;
int set = 0;
int dif = 0;
// State
int state = 1;
// Time Variables
long echo = 0;
int dly = 100;
// 120 seconds
// Avg red light Wait 90 seconds
long sepone = 22500;
long septwo = 45000;
long septhree = 67500;
long sepfour = 90000;

// LEDs and Piezo
// Green
int one = 3;
int two = 4;
int three = 5;
// Yellow
int four = 6;
// Red and Piezo
int five = 7;

void setup() {

Wire.begin();
Wire.beginTransmission(MPU_addr);
Wire.write(0x6B);
Wire.write(0);
Wire.endTransmission(true);

Serial.begin(9600);

pinMode(one, OUTPUT);
pinMode(two, OUTPUT);
pinMode(three, OUTPUT);
pinMode(four, OUTPUT);
pinMode(five, OUTPUT);

digitalWrite(one, HIGH);
digitalWrite(two, LOW);
digitalWrite(three, LOW);
digitalWrite(four, LOW);
digitalWrite(five, LOW);

}

void loop() {

// GY-52 Communication
Wire.beginTransmission(MPU_addr);
Wire.write(0x3B);
Wire.endTransmission(false);
Wire.requestFrom(MPU_addr, 14, true);

// 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
AcY = Wire.read() << 8 | Wire.read();

// Variance From Last Position
dif = AcY - set;

// Testing
Serial.print("YAxi ");
Serial.print(AcY);
Serial.print(" Difr ");
Serial.print(dif);
Serial.print(" Mils ");
Serial.println(echo);

// IF Motion Reset Minimums
if (dif > high || dif < low) {
digitalWrite(one, HIGH);
digitalWrite(two, LOW);
digitalWrite(three, LOW);
digitalWrite(four, LOW);
digitalWrite(five, LOW);
state = 1;
echo = 0;
}
else {
if (state == 1) {
if (echo >= sepone) {
digitalWrite(two, HIGH);
state = 2;
}
}
else if (state == 2) {
if (echo >= septwo) {
digitalWrite(three, HIGH);
state = 3;
}
}
else if (state == 3) {
if (echo >= septhree) {
digitalWrite(four, HIGH);
state = 4;
}
}
else if (state == 4) {
if (echo >= sepfour) {
digitalWrite(five, HIGH);
}
}
}

// Reset Last Position
set = AcY;

// 1/10 Second
echo = echo + dly;
delay(dly);
}

Archive
http://hackaday.com/2016/03/29/stop-wasting-gas-while-tweeting-with-this-car-idle-alarm/
https://hackaday.io/project/10313-idle-waste-alarm

18:40:34 365-015