-
Current Measurement and finding 5 V on the Nano33 IoT
05/11/2021 at 20:04 • 0 commentsThe current prototype of the MicroGrid Connection Unit uses a regular 5V Arduino Nano, and an ACS712 current sensor to measure the current flow to or from the grid. Unfortunately, the Nano33 IoT is running at 3.3V instead of 5V, but the ACS712 doesn't work at that voltage level. At least it's not really intended to. So there are a few options to deal with this:
- Finding a different current sensor
- Run the ACS712 at 5V, and "step down" the output using a voltage divider
- Doing something completely different
---------- more ----------Finding a different current sensor
Why did I go with the ACS712? Easy, because it's what I had on hand. I have a bunch of these little things in my parts drawer:
They are quite easy to use, so that's what i decided to go with. Its data sheet mentions the following supply voltage range:
So this won't do for the 3.3V of the Nano33 IoT. So what do we do about it? The first idea was to check out the ACS712 maker, to figure out if it's part of a series, which also has modules for a different supply voltage range. And tada, turns out, there is the ACS711:
This would be just the part. This definitely goes into the next parts order. But that'll take a few more days, so what are the other options we have?
Finding 5V on the Nano33 IoT
It would be quite possible to just keep using the ACS712. How? Power the ACS712 off 5V, and use a voltage divider to adjust the output of the module to be compatible with the Nano33. Like so:
Most of this is rather straight forward, but one thing was interesting: Where do we get the 5V from? If you look at the pinout of the Nano33, there is a 5V pin:
In the MicroGrid Connection Unit, the Arduino will be powered from the local (solar) system via the VIN pin, and it will not be connected via USB. Now my memory tells me that there's only one voltage regulator on that Arduino, so where do the 5V come from? Let's look at the schematics. This is the connector section of the official schematic:
Pin 12 is the +5V pin, and if you look at it, you'll see that it's normally not connected at all. No 5V without doing some soldering, on the underside of the Nano33:
And then it's connected to VUSB. What's that? Also in the schematic:
VUSB is connected to the USB connector. Which, when plugged in, gets us our 5V. So how does the voltage regulation to 3.3V work?
That's where this section of the schematic comes in. The right side is the 3.3V voltage regulator. It "feeds" off of the VIN pin, and puts out 3.3V. But how does the Arduino power up on USB, without VIN connected? That's the part I almost missed. But there's a tiny schottky diode, D2, connecting VUSB to VIN. So if the USB port is connected, there's 5V on VUSB, and 4.5V on VIN. If VIN is connected, D2 blocks that from passing over to VUSB, potentially breaking whatever is connected to the USB connector.
So where does this leave us? Pretty simple: No USB connection, no 5V. I wish that were a little clearer in the pinout. Can we still use the ACS712? Sure, but we do need a separate voltage regulator. Good enough for now, while I wait for the ACS711 order, but not really the nicest hack to go into some sort of a product later down the road.
Other options
Of course there would be other options I could look into to measure the current, the most obvious one being a shunt. But I've never done that. and I also don't have the parts on hand to do so. I found this blog post, which will be something I'll look into and need to learn the ins and outs of but for now, I'll stick with what I know.
-
First Prototype
05/11/2021 at 20:03 • 0 commentsHaving done a rough design of the MicroGrid Connection Unit, the next step was to build it on a breadboard and start writing some code. I decided to use a regular Arduino Nano for the first phase, in order to not risk breaking the Nano33 IoT. They are mostly pin compatible so that should be only a small adjustment later on.
---------- more ----------One thing I noticed that I missed in the original design post was a way to measure current, which I feel is rather critical. I had some ACS712 modules on hand, so I decided to use one in here. They are supposed to run on 5V, so they work on the regular Nano, but I'll likely have to find a different solution when going back to the Nano33 IoT. But that's for later to figure out. Here's the updated breadboard design:
For easy testing, I used two batteries, one to represent the "local system", and one to represent the grid. A few things that I decided to test:
- Voltage measurement on both sides, with the MOSFET disabled
- Current measurement
- MOSFET duty cycle calculation
- Emergency cutoff
The grid battery has a little less charge, so ideally the local system should feed some energy to the grid battery. I didn't manage to take any pictures, but it seemed to work fine. Using a multimeter, I was able to verify the measurements of both voltage dividers as well as the current measurement. The batteries themselves were not enough to trigger the over-current protection, so I added a 12V LED bulb, which did the job. The dutycycle calculation did not manage to quite deal with that situation properly. The overcurrent triggered as it should, but it wasn't able to dial in a decent dutycycle to make it work as I would've liked.
The Arduino code provides a bit of debug output, which allowed for some more details on what the connection unit is doing, and why. There'll need to be a bit more testing, which probably requires a better test setup than what you can currently see on my bench. But we have a decent start
The Fritzing file as well as the Arduino source code is now up on GitHub: https://github.com/tiefpunkt/microgrid_connection_unit
-
Design
05/11/2021 at 20:01 • 0 commentsIn the first post, I shared an overview of the different options of the Connection Unit I'm looking to build over time. For now, I want to start with the simplest version, which is supposed to connect a solar system to a grid of (roughly) similar voltage, say a 12V solar setup to a 12V micro grid (which will be the configuration I'm planning to test this in). Here's the important part of that first drawing again:
---------- more ----------In the progress of constant learning since making that sketch, I came to realize that when using MOSFETs, I might not have to do two separate paths for switching here, but I could do it with one. But I always learned on another recent projects that still a single MOSFET would not suffice, it would be a back-to-back configuration needed to make this work, because thanks to its internal bypass diode, MOSFETs will only block current in one direction.
I'm planning to build the prototype on a breadboard, so I decided to give Fritzing a try in designing this. Well, that kinda worked, but it looks like I won't move away from KiCAD any time soon for the real PCB & schematic design work Anyway, here's the schematic (sorry for the messed up ground wires:
To make things a little clearer, here's an annotated version of that:
There are a few things I left out here, which will be in the later KiCad design, but I got a bit fed up with Fritzing. There'll be some over-voltage protection diodes, specifically on the grid side, as well as a fuse to protect from excessive current. The voltage dividers will get 100nF capacitors in parrallel to the grounding resistors. And there's probably more, like a status OLED screen etc, but I couldn't find the part in the software.
When put on a digital breadboard, the whole thing looks like this:
And that's basically the plan for the weekend, to copy this into the physical world. I'm thinking about instead of using the Nano33 IoT to start off with a regular Nano. They are pin-compativble, except for the analog reference voltage, which is something I should be able to deal with, but it would hurt much less if I screw something up. And if that works fine, I can always switch to the Nano33 IoT and build "the real thing".
-
Introduction
05/11/2021 at 19:58 • 0 commentsHello there! Here's the introduction to my project for this year's Design For a Cause challenge, the MicroGrid Connection Unit. I want to create a device that allows to connect existing DC power systems to a small grid, e.g. to allow multiple caravans with solar systems to each other. Let's go into how I got to this idea.
---------- more ----------The Problem
Festivals and camps sometimes happen out where there is not enough electrical infrastructure to support them, so generators and other power generating equipment has to be brought. At CCCamp2015, there was the idea to at least partially solve this problem by creating micro grids. Many people bring solar systems in their campers or by other means, and sizing of those is usually above what's necessary, especially if you're out and about all day. By creating means to connect these systems and share clean solar energy with others, the dependency on fossil fuel based power generation could be reduced.
Since then, discussions with others as well as reading different kinds of literature on the topics has shown me that this topic not only applies to the situation above, but is also interesting in other scenarios with potentially more impact, like tiny-house collectives, or off-grid villages in third world countries.
Design Plan
We had the idea to create a connection box that allows easily connect your own solar system to a micro grid of other similar systems. The MicroGrid Connection Unit should ensure the safety of your own system, adapt to the specifics of the microgrid in question, and allow for monitoring and statistics.
The connection unit should measure voltages on both sides of the unit (private system, the micro grid) and decide whether to provide power to the grid, or pull energy from the grid. Doing either one, it should keep track of the energy consumed or provided. It should safeguard itself and the private system by checking for over-voltage in the grid, under-voltage in the private system (to protect batteries from depletion), excessive currents and other potential dangers. The information it gathers should not only be used internally, but also provided to the user, e.g. via a WiFi or BLE interface, or longer range technologies such as LoRaWAN. It could also provide additional adaption to the grid, like DC-DC-conversion if the grid is operated at a different voltage than the private system.
These additional adaptions lead to multiple possible iterations of a MicroGrid Connection Unit, as shown in this little sketch:
Next Steps
To get started, I'm planning to build the first and simplest version which should allow for a unit to connect to a grid at the same voltage level, while showing information on a LCD or OLED screen. The idea is to eventually be able to configure the unit and gather metrics from it with a smart phone or laptop, so creating that interface will be step two. After that, we'll see how far I can go to implement a DC-DC converter to create a much more advanced unit.