Introduction: Connected Charger

Picture of Connected Charger

Some month ago I've bought a electric scooter for my every day drive to work. He is called HP_BEXXTER (just google it for more information:-))

Now I wanted to know how many energy I need for those drives. Also I want to collect more information about my usage of the scooter but for now I started with the charger.

The function in quite simple: Collect the energy data from the charger by an ESP8266 and push it to a InfluxDB server. For visualization I'm using grafana.

Step 1: Electric Meter + ESP8266

Picture of Electric Meter + ESP8266

Somehow I need to get the electric power consumption. The first idea was to create a PCB to measure the values directly. But while I'm googleing for input I've found a power meter with a S0 interface for 15€.

Now it was quite simple to get the consumption. Every 1/1000 kWh I get a peek on the interface.

All the components were then mounted on a wood plate.

To power the ESP8266 I've hacked a old usb charger... It's not the way you should do it.

Step 2: First Test and ESP8266 Schematics

Picture of First Test and ESP8266 Schematics

After the build up from most of the hardware I've started the development of the schematics... It is ONE resistor.

But I've used a breadboard for that...

The resistor is needed to pull the voltage to ground if the S0 interface is on low.

The Code is also quite simple I'm using the std. arduino workbench for such simple projects. The code is downloadable here and based on two toggling interrupt handler.

Step 3: Hardening the HW...

Picture of Hardening the HW...

... I simply need the breadboard for other projects :-)

Step 4: Set Up InfluxDB and Grafana

Picture of Set Up InfluxDB and Grafana

I've set up the influxDb and the grafana on a old raspberry pi you can do that on every computer. I don't write down a complete how to for the installation only the hints for running the stuff on a rpi1.

you can download the .deb install and run grafana:
wget https://dl.bintray.com/fg2it/deb-rpi-1b/main/g/gr...
sudo dpkg -i grafana_4.2.0_armhf.deb
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable grafana-server
sudo /bin/systemctl start grafana-server

The InfluxDB is configured for UDP and the database is stored on a USB flash drive. The configuration file is stored here: /etc/influxdb/influxdb.conf

[meta]
# Where the metadata/raft database is stored
dir = "/automnt/usb-stick/influxdb/meta"

[data]
# The directory where the TSM storage engine stores TSM files.
dir = "/automnt/usb-stick/influxdb/data"
[[udp]]
enabled = true
bind-address = ":8089"
database = "test"

To configure the databases and other stuff you need to grant admin access:

[admin]
# Determines whether the admin service is enabled.
enabled = true
# The default bind address used by the admin service.
bind-address = ":8083"

Now you can log in to your DB by your browser and create a database, you'll find enough example on the web how.
http://<THE IP FROM THE DB>:8083/

Then you can also configure grafana. Also here you'll find the examples online.
http://<THE IP FROM THE DASHBOARD>:3000

For the visualization you can see in the screen shots what I've done.

Step 5: Next Steps

I want to collect data also from my Scooter:

- GPS Position
- Temperature of the Motor
- Temperature of the Battery
- Temperature of the environment
- power consumption of the drive unit
- Accelerometer

If somebody want some things explained more in detail, please contact me...
I'll also add the new data in this instructable.

Comments

nerduw (author)2017-06-26

Great tutorial! Looking forward reading more from you.

Just an idea for potential next steps: what about monitoring the power input of your scooter rather than the power output of your home socket? A quick, and mostly effortless way, would be to simply attach a hotspot to your scooter that the ESP8266 can connect to (dirty but functional). Alternatively, I believe there are plenty of SIM800x (cheap) based tutorials available here.

About This Instructable

734views

16favorites

License:

Bio: Hi, my name is John. My hobby is to solve problems from other people and creating nice and functional stuff out of trash. I'm ... More »
More by Layer 8:Cable StripperConnected Charger Wall Garden and "shelf of Shame" Out of Old Wood
Add instructable to: