Connected Charger

by Layer 8 in Circuits > Electronics

1383 Views, 17 Favorites, 0 Comments

Connected Charger

IMG_1188.JPG
IMG_1186.JPG
Screenshot at 2017-06-25 23-05-14.png

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.

Electric Meter + ESP8266

IMG_0726.JPG
IMG_0728.JPG
IMG_0729.JPG
IMG_0732.JPG
IMG_0730.JPG
IMG_0731.JPG

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.

First Test and ESP8266 Schematics

IMG_0733.JPG
IMG_0727.JPG
IMG_0734.JPG
IMG_0735.JPG

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.

Hardening the HW...

IMG_0737.JPG
IMG_0738.JPG
IMG_0736.JPG

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

Set Up InfluxDB and Grafana

Screenshot at 2017-06-22 10-47-01.png
Screenshot at 2017-06-22 10-47-46.png

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://IP to influx DB:8083/

Then you can also configure grafana. Also here you'll find the examples online.
http://IP to influx DB:3000

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

To test the connection you can use you linux machine:

echo "powertick value=1" > /dev/udp/<IP to influx DB>/8089

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.