Intro: Mario Question Block Solar Monitor
We have a solar panel system on our roof that generates electricity for us. It was a large investment up front and pays back slowly over time. I have always thought of it as a penny dropping into a bucket every few seconds when the sun is out. Day after day those pennies add up! I decided to build a monitor that would bring that concept to life. A question mark block from Mario Brothers turned out to be a perfect fit. Every time our solar panels generate one penny worth of electricity, the block lights up and plays the Mario coin sound. Every time the panels generate one dollar worth of electricity, (100 coins) it lights up and plays the Mario 1up sound just like the game. It is a happy reminder that my panels are working hard even when I am not.
Note: The code in this project currently only works with Enphase systems. If you have a system with a different monitor, I would love to collaborate on a solution that would work for yours, just leave a comment below.
Step 1: How It Works
This project uses a NodeMCU to wirelessly connect to the the Enphase Envoy box to monitor solar production. If you are currently connected to a network with an Envoy on it, check its IP address by looking at the screen on the box. Mine is currently at 192.168.1.10. If you follow the link below you will get a short (JSON) text response that indicates how much energy your panels have generated so far and the current power output.
http://192.168.1.10/api/v1/production (You will probably have to change the 192.168.1.10 part to match your Envoy IP address.)
This project uses the "wattsNow" value and a price per kilowatt hour provided at setup to calculate how long it takes for the system to generate one cent worth of electricity. Once that amount of time passes, it plays the coin sound and flashes yellow.
Step 2: Gather the Materials
You will need the following to build this solar monitor.
- NodeMCU Amazon $4.99
- Mini Breadboard
- Yellow and Green LED
- Piezo buzzer
- 2-100 Ω resistors
- USB Micro B cable (I used a short one to power the project and a longer one to upload the program)
- Jumper wires
- USB wall adapter (I used an old iPhone charger)
- Enphase Envoy Monitor connected to a wireless router
- 3D printer, with preferably yellow filament
- 3 pieces of plexiglass cut to 3-1/8" square
- white spray-paint (I used Rust-oleum, but something more transparent would probably be better)
Step 3: Get Started With the NodeMCU and Upload the Program
Magesh Jayakumar has created an excellent instructable on getting started with the NodeMCU. Quick Start to Nodemcu ESP8266 on Arduino IDE It is clear, to the point, and gives a few examples. It is worth checking out if you are new to NodeMCU, but I will give the important steps here too.
- Download, install and launch the Arduino IDE.
- Go to preferences and enter the following address in the "Additional Boards Manager Urls:" text box then click OK.
- Go to Tools>Board>Boards Manager. Search for ESP8266 and install "esp8266 by ESP8266 Community"
- Go to Tools>Board>NodeMCU 1.0. It will be listed below the other Arduino boards.
- Make sure your NodeMCU is connected by USB and go to Tools>Port>Select your USB port.
- Download and open the SolarMonitor.ino file and open it in the Arduino IDE. At the top of the program there are 4 pieces of information that the program needs to run successfully. These are your wireless network ssid and password, your Envoy IP address listed on the Envoy screen, and the value of one kWh of solar energy in cents. You can get this last value from your electricity bill. If you are enrolled in an SREC program through your state, add that too.
- Upload the modified program to your NodeMCU by clicking the upload (arrow) button at the top left of the window.
Step 4: Build the Electronics
Refer to the wiring diagram above to build the electronics components. Summary is below:
- Positive end of green LED connected to D6, Negative end to 100 ohm resistor.
- Positive end of yellow LED is connected to D7, Negative end to 100 ohm resistor.
- Positive end of piezo buzzer is connected to D8.
- All circuits terminate at GND.
Step 5: Build the Box
Use the STL files above to print the box. I used yellow filament. To make the question mark inserts, cut three squares of plexiglass 3-1/8" x 3-1/8". I wanted the question marks to let light through but obscure the electronics inside so I gave them a light coating of white spray paint. I used Rust-oleum, but something more transparent would probably work better. Once the inserts are dry, use a few dabs of hot glue to secure them to the inside faces of the box. Then add the wall adapter to the box with the prongs sticking through the back. Secure it in place with a dab of hot glue on the bottom.
Step 6: Add the Electronics
Plug your USB cable to the wall adapter and connect it to the NodeMCU. I used a shortened cable here to minimize clutter in the box. Finally stick the breadboard to the back of the box using the adhesive on the bottom, or another dab of hot glue. Pop on the top and plug that sucker in. Before you know it, you'll be up to your eyes in Mario coins!
Step 7: Future Steps
- If you have a solar panel system made by someone other than Enphase, I would love to help you get this working on your system too. As long as there is some sort of local or web-based API it should be straightforward string manipulation. Post a comment, and if I can help I will.
- I may add a numeric display so I can see the cents ticking up each time it bings. Stay tuned.