AutoOffset uses a Particle Photon and Carloop OBDII adapter to automatically offset carbon emissions from vehicles using the Wren.co API.
This code integrates speed readouts from OBDII to calculate distance and emissions. While some cars have fuel-level PIDs, it is not standard across vehicles and years the way speed PIDs are, and I wanted to make this compatible with as many vehicles as possible.
This app could also be implemented with GPS and cellular instead of OBDII readouts and WiFi, but I wanted to make an app that didn't require tracking or persistent data. Let me know if you make the more sophisticated version!
- Particle.io Photon
- Carloop (you may have to find one used)
- Wren.co API key
- A vehicle with OBDII
- Setup the Particle Photon and flash it with AutoOffset.ino. Be sure to include the Carloop library using the Particle Web IDE or by directly downloading it.
- Register a Wren.co API key
- Setup a Particle Webhook titled
Offset Carbon
toPOST
to https://www.wren.co/api/offset-orders with your Wren API key in the headers andCUSTOM BODY
set to:
{"tons":{{{PARTICLE_EVENT_VALUE}}},"note":"tons carbon offset","dryRun":true}
- Configure the MPG variable in the source code to match your car's (line 17 in AutoOffset.ino)
- With the Photon setup, install it in your car's OBDII port
- The app should run automatically and publish to the Particle Webhook when the Particle connects to internet in test mode (i.e. does not charge your Wren account)
- When you are done testing, the
dryRun
flag in Particle Webhookbody
can be set tofalse
to start buying offsets
Please help me refine this project. What I'd like to implement:
- Deep sleep the Particle when car is off in a broadly compatible way (RPM detect? CAN traffic?)
- Fork a version to use GPS instead of OBDII
- General code refinement
This project is licensed under the Creative Commons Zero v1.0 Universal License - see the LICENSE.md file for details
Thanks for the help: