Introduction: Nabito [Open Socket V2]: Smart Meter for EV Charging

This is the second build guide for Nabito [open socket), the first version can be found at: Nabito [open socket] v1

I list the reasons for creating this project in this blog post: EVs are pointless for apartment people

What is it?

Nabito - the open socket is an IoT smart meter with electricity metering, on/off high amperage switching, NFC sensor, user authorization, billing capabilities and user management.

The project consists of two parts: 1. control box (IoT device) 2. web app frontend/backend, both completely open-source.

1. The control box consists of easy-to-get-online parts and is designed to be an intelligent and yet inexpensive electric socket solution for public and private parking lots for slow charging of electric vehicles. It runs on Raspberry Pi Zero W and Arduino Nano.

2. The web app runs on Ruby on Rails and is available as open source on Github: https://github.com/sysdist/nabito-server The connection between the box and the web app is done through MQTT protocol.

The aim of the project is to develop an open source charging network that anyone could adopt and implement or extend.

The control box consists of easy-to-get-online parts and is designed to be an intelligent and yet inexpensive electric socket solution for public and private parking lots for slow charging of electric vehicles.

It runs on Raspberry Pi Zero W single-board computer (SCB). The total cost of the control box is around €60.

Nabito - the open socket is currently designed for charging on ordinary sockets, in continental Europe it's 230V and 10 -13A, i.e. cca. 2.9kW continuous. But the concept applies to any socket, Euro, US or UK or any other, future versions of the project will cover also 2 and 3 phase installations.

Specs:

  • Single PhaseVoltage: 230 V
  • ACMax. current: 13 A
  • Power: 2.9 kW
  • Size: 240x200x90mm
  • Interface: RJ45 LAN connection or WIFI
  • IP compliance: IP55

The following build guide is not complete, it's missing some wiring diagrams, some assembly steps, etc.), I wanted to get it out there as soon as possible, will work on improving it gradually, so please, if this build guide does not cover everything you need to know or if you have any questions, send me a mail. Thanks for understanding.

Step 1: What Does It Do?

Picture of What Does It Do?

The project consists of two parts, the physical control box which is an IoT thing (client side) and there is a Web application that controls it (server side).
Combined functionalities:

1. On/Off switching
With a mains relay and a contactor it can switch the outlet socket on/off based on user interaction.

2. Energy metering

The control box measures AC current and logs power usage. Standard metering function. The energy metering is done per user. Currently there is only AC current monitoring, no voltage monitoring at this point.

3. User authentication

You need to create user accounts for the users who will be using the socket/s. The user authorizes by reading the QR code or using an NFC tag. The web user interface allows users to sign up, log in and use the control box or the NFC tag switches the box on/off directly. Admin can approve, disapprove users.

4. Billing

Based on admin's socket configuration and price per 1kWh bills are created for individual users based on their energy usage. Monthly bills will be created later for admin convenience.

Step 2: HW and SW Stacks

Picture of HW and SW Stacks

HW stack:

Total HW cost: €60.59 ($70.40)

SW stack:

  • Control Box stack:
    • Raspbian Linux (Ubuntu based), open source, $0 (all glory to Linus Torvalds + 20k people who worked on Linux kernel + the kind people behind Raspberry Pi and Raspbian Linux image)
    • Node-RED, open source, $0 (kind people from IBM that are behind the development of Node-RED)
  • Web app stack:

Total SW stack cost: 0 (*THUMBS_UP*)

Step 3: The Control Box: SW Setup

Picture of The Control Box: SW Setup
  1. Install RASPBIAN STRETCH LITE (we don't need the desktop version) on Raspberry Pi Zero W
    https://www.raspberrypi.org/downloads/raspbian/
  2. configure Raspbian to use your local home Wifi
    http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/
  3. Install Node-RED on Raspbian
    https://nodered.org/docs/hardware/raspberrypi
  4. Copy Nabito Node-RED flow and deploy it
    https://github.com/sysdist/nabito-client-node-red
  5. Edit default Node-RED settings.js and add this to the functionGlobalContext:
    relay: "OFF",

    box_status: "OFFLINE"

  6. Configure your Node-RED MQTT brokers towards your preferred Nabito-server installation (or towards http://nabito.org)
  7. Restart Node-RED
  8. Check the MQTT connectivity in Node-RED

Arduino part:

  1. Download, compile and upload this sketch to Arduino Nano
    https://github.com/sysdist/nabito-arduino-nano.git
  2. Done! ;-)

Step 4: Wiring: Mains Cables

Picture of Wiring: Mains Cables

The AC mains cables supply power to the:

  • AC contactor
  • Mains relay
  • Mobile charger that powers Raspberry Pi and Arduino

The output from the AC contactor goes to the outlet socket. Protective earth is connected from the source mains line to the outlet socket.

Raspberry Pi controls the mains relay and the relay in turn switches on/off the contactor.

Step 5: Wiring: Arduino, CT Sensor, NFC Sensor

Picture of Wiring: Arduino, CT Sensor, NFC Sensor

Wire the Arduino with the CT sensor according to the following manual:

https://learn.openenergymonitor.org/electricity-mo...

You need:

  • Arduino (you can use any Arduino: Uno, Nano, Mega, whichever you like, as long as it has an ADC)
  • 10uF capacitor2x 10kOhm resistors
  • 3.5mm female jack socket
  • CT sensor 30A/1V
  • PN532 sensor (RFID/NFC)
  • small PCB
  • small wires for connections

I soldered the Arduino Nano, the capacitor, the resistors and the female jack to the PCB according to the above manual from the openenergymonitor.org site.

The NFC sensor is connected to the Arduino Nano through SPI (pins on Arduino Nano: 10, 11, 12 and 13).

The Arduino is connected to the Raspberry Pi via the micro USB.

Step 6: Wiring: Raspberry Pi

Picture of Wiring: Raspberry Pi

Connect Arduino to the Raspberry Pi via the USB port, this way it serves as a serial port and a power supply for the Arduino, it should map to /dev/ttyUSB0.

The mains relay is connected through pins 2 (5V), 6 (GND), 12 (GPIO).

The front-panel LEDs are connected through pins 14 (GND),16 (GPIO),18 (GPIO)

Step 7: Wiring Everything Together

Picture of Wiring Everything Together
  1. Clamp the CT sensor on the mains line going out of the mains relay
  2. Connect power source for Raspberry Pi
  3. Screw in the junction box lid
  4. And you're done wiring/assembling!

Step 8: Web App Setup

Picture of Web App Setup

You need a linux server to run the web app. You can either:

  • run the server locally on your PC/notebook or your local Linux server and point the control box[es] to your local installation
  • create your own domain and run the web app as a website
  • use http://Nabito.org (it's free) to manage your control boxes

Nabito-server app runs on Ruby on Rails and is open source:
https://github.com/sysdist/nabito-server

For web app installation and setup refer to the project's README.md on Github.

Step 9: Running and Testing

Picture of Running and Testing

For local setup:

  1. Deploy the Nabito-server app on your local PC/notebook
  2. Configure mosquitto MQTT broker on your PC (or any other MQTT broker of your preference)
  3. Connect the Nabito control box to your local WiFi
  4. SSH into the box and direct it to use your PC's MQTT broker
  5. start the rails nabito-server app
  6. connect a small electrical load (e.g. a table lamp) to the outlet socket
  7. use the web app to start/stop the socket id 1 to check the actual and total energy consumption
  8. use an NFC tag (if you have one) to toggle the socket
  9. check the billing for the last socket usage
  10. After successful testing, start creating your own EV charging network
  11. Profit ;-)

Step 10: The Conclusion, Issues and Product Roadmap

Picture of The Conclusion, Issues and Product Roadmap

In this version of the Nabito control box I was able to decouple the control box and the web app essentially creating an IoT (Internet of Things) project with both the physical thing that does something useful and a back-end app and service that manages the physical thing.

The price of the box increased a little bit from the last version (v1 before: €50, v2 now: €60), because I added a contactor for safety purposes to serve higher amps and also RPi is a bit more expensive then OrangePi boards.

MQTT is used as the main protocol for data logging and controlling the box.

Since the last version of Nabito, I was able to solve most of the issues (Wifi, contactor, processor overheating, integrated outlet socket, etc.). However the list of current issues and opportunities grows further:

Issues:

  • Raspberry Pi Zero W is a very nice board, with Wifi and Bluetooth and 2 GPIO pins, but still the processor heats up to 34C when idling which could be problematic in warm climates and summer months with direct sunlight
  • Running Linux in the control box is good for prototyping, but the production model of this product should probably run on a leaner board which is capable of TLS/SSL (chip ESP32 looks very promising)

Opportunities:

  • create versions for higher currents (functionality the same, but use contactors with higher amps and different CT sensors/energy monitor modules)
  • create versions for 2 and 3 phases
  • integrate energy monitor module (like the Peacefair PZEM-004T Energy monitor)
  • migrate to ESP32 for increased power and heat efficiency
  • integrate to AWS IOT cloud and use client certificates for best security setup (right now only MQTT user/password is used)
  • manage certs and MQTT credentials from the web app (currently this is manually configured thru back-end)
  • add small LCD panel to present info directly on the Nabito control box
  • add numpad to provide button interaction with the box (pin possibility for increased security)
  • include additional thermometer to monitor the ambient temperature of the box

If you like this project or have any questions/comments please feel free to contact me at sysdistcom@gmail.com

Systems distributed website: www.sysdist.com

You can follow me at:
twitter.com/sysdist
fb.com/sysdist

Have a nice day and happy making!
--Stefan

Comments

About This Instructable

1,609views

19favorites

License:

Bio: Systems Distributed is my personal initiative to build, integrate, install and promote distributed systems solutions that are based on open source wherever open source is ... More »
More by systdist:Nabito [Open Socket V2]: Smart Meter for EV ChargingNabito - the Open Socket: Smart Meter for EV Charging
Add instructable to: