vendredi 3 avril 2020

Solar power monitoring & diverting

Today I focus on Solar power generation and monitoring.
The project started from Open energy monitor.

The system I am building is a variant which will look like this :

Due to the fact that prices of Photovoltaic generators, panels and converters are much cheaper now than a few years ago, they have become a must for anyone who can install them on his roof or garden. They are also much less of a burden to install and declare, at least here in France.
Due to several constraints, I had to realize my own version of this system. And of course I had to share it...

The main unit is this :

For those interested in this power monitoring circuit, this is what it does:

- Displays actual used power from the grid
- Displays power generated from the PV cells
- Displays power used by a secondary circuit (second part of the house)
- Shows a few additional symbols for PV usage, operation, percent of diversion, etc...
- Uses an independant OLED display. One can easily customize what information it provides.
 - Fully independent. It is enclosed in a box which fit in a standard electrical board.
- Has a flashing LED on the front face whose colour is changing (more fancy). The more PV power you generate, the more bluish you get, plus green when you are diverting your surplus of energy.
- Has the capability to manage Power diversion.
- reset button on the front

What is power diversion ?
When you generate extra solar capacity, this power is not returned to the grid but is delivered (and modulated) to your power heater. This acts like an energy storage.

Now, if you need to design the same:
Look at first and you will have plenty of resources to understand what we want to achieve. Mine is just a special variant of EmonTx.
Because I had plenty of problems and constraints, I had to finish with that special version, but it is eventually working very well for the purpose.

The files are on Github here

There should be enough comments in the code to make or modify it. Email me if needed or to show what you have done.

As mentionned, I have used an EmonTX shield on top of an arduino board.
A classic Arduino UNO is not fit for my usage, more memory required. Therefore a board with a minimum of 80 K Sram is required. That should be easy to transpose to another board but I have not tried yet. I have used the Arduino 101 because I had one in my box and it is fit for the shield, has lots of memory and is faster.
But Arduino101 is discontinued now.
If you need another board, make sure that libraries you use are compatible. Also check voltage.

I had tons of problems to setup all that. They started with installing correctly the libraries. Just before I became asphyxiated, I found the right info here :

Libraries : After many tryouts, I eventually ended with the library EmonLib. It performs all the magic to measure  power, voltage and more if needed.

the board under development.
OLED graphic displays are easy and relatively simple to handle. I have used the library U8glib which has plenty of examples. Also, it does not interfere with the routines of Emonlib and enables data transmission on serial bus if needed. My display is a pure chinese 128x64 found on Amazon. Should work with most other displays. It operates either on 5V or 3.3V. But it is quite sensitive to power supply quality. Make sure there are no interferences passing trough the supply. Also add 4.7K resistors to positive on SDA/SCL.

Power diversion : The software is ready for it. Nevertheless, I will need to setup a second device which will come soon on those pages. be patient, but Covid will help a lot by giving all this spare time !

The EmonTX shield had to be modified. I had to cut two pins, A4 and A5, which were blocking operation of the I2C bus used for the display. You must do so, even if you want to use pins SDA/SCL. Radio module on the shield must not be installed.(I had to remove it)

Pins A4 and A5 cut on the shield

Enclosure : if you need to make an enclosure, I have put the STL files in the parts folder, as well as the original file for Designspark mechanical. I have used the box made of the orange "PRUSA" Petg. The box is a bit tight for an Arduino UNO size but fits well in the power cabinet.

STL. files are availble to build a casing

All must fit in !

And the future of this :
Things to come;
- Additional remote unit to operate the power heater from the PWM signal.
- Temperature sensor on (inside) the water heater. Water has to be kept at sufficient temperature, at least once a day. And once every 3 days pass over 65°C to avoid water contamination.

mercredi 25 juillet 2018

Arduino and MPU6050

Arduino and MPU 6050 - attitude display This is a different project. I had a request from a friend to work on it and try to achieve a reasonable operation. The purpose of this board is to present attitude (pitch + roll) on a small instrument display. Arduino board : Arduino MEGA 2560, but most arduino boards should fit. Arduino MEGA provides better fluidity. Display : arduino shield TFT display 480x320. No other display dimension is possible because this is designed just for it. Sensor : MPU 6050. It provides acceleration and gyroscopic data. Issues; be careful, there is an issue with the wire library on some clone arduino boards. These do not respect I2C timings and this creates uniques bugs; freezing of display. Use a genuine arduino board for this program to work. Connection: extremely easy: no schematic given, as it only needs I2C connection to the MPU and power supply. Display shield interfaces directly.

jeudi 7 juin 2018

LISA : Light Instrument for Small Airplanes

Hi all ! I had to find an easy name for those projects, and this is LISA: Light Instrument for Small Airplanes. This single instrument combines sensor and a small Oled display for : - ATTITUDE Display (Pitch& Roll) - AIRSPEED - ALTITUDE (with QNH, barometric reference selection) - VERTCAL SPEED - TEMPERATURE - CHRONO However, it could be interesting to add features such as - G-METER (With GMAX display) - SIDESLIP INDICATOR (for turn coordination) A page is available to program a few features such as which page to set for startup.. The OLED display is there just for a minimal backup (standby instrument) The parameters are transmitted through the serial bus and are intended for further display. This is the task of my other display program, using processing. The final instrumentation would combine this sensor (LISA) with its own Oled display, plus a full size display, 800x640 pix for more comfort, driven by a raspberry PI. A youtube video is here to see functionalities : A github repository here :


And here is the latest version 

mardi 24 avril 2018

Mini instrument for ultralight Aircraft

Réalisation d'un capteur intégré et d'un afficheur pour avion ultraléger C est un travail en cours Une bonne partie du logiciel tourne correctement. Ça donne ça : Reste a finaliser un circuit imprimé pour faire un montage propre, connecter un capteur de pression pour lire la vitesse et mettre le tout bien au point. Ensuite relier le tout à un affichage couleur et au soft développé précédemment pour avoir un bel EFIS.

mardi 13 février 2018

Tout sur github

Bonjour, hello, ola, buenos dias !!!

I start to put my work on github.

C est plus facile pour ceux qui voudront récuperer mon travail.
Ce sont des "beerwares", quoique je boive assez peu de cette boisson.
Ou des"drinkwares" si vous préferez.

Use and enjoy !!!

Mais je mettrai d abord la primeur en français sur ce site.

Le job du moment : fabriquer un Adiru de 20 grammes.
Au menu, ESP32, MPU9250, BMP280. C est prétentieux, je sais, mais on peut toujours essayer.

mercredi 29 novembre 2017

Oled display and Arduinos

This article is to highlight a few points for anyone wanting to use an Oled display with Arduinos.
I had a few trouble with them, therefore it is also a reminder for me.
These are the cheap Oled displays (0.96 In  or 1.5 In, 128x64  ) connected via I2C, found everywhere on the net.
Power supply ; 3.3 V  or 5V, any voltage is Ok, no difference in brightness.
SCL connected to pin A5
SDA connected to pin A4

Arduino uno and Oled display;

For some unknown reason, the Arduino UNO could not raise correct signals. The thing worked when the two signals SCL and SDA were connected through 10K resistors to Gnd.

The U8Glib library worked fine. I have used as header :

#include "U8glib.h"
#include <Wire.h>
and as descriptor
U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); 

Arduino 101 and Oled display;

Although the 101 could seem compatible to the UNO, it is not exactly.
Differences are
-the core is a 32 bits core
- voltage is 3.3 V
Because of that, the U8g2lib will not work.

Why using the 101 ? Because it has accelerometers, gyros, more memory and will use a real time operating system (multitasking)

In that case, Oled displays do not need any resistor.
Supply is 3.3V, of course.

As a header I have used succesfully
#include <U8g2lib.h>
#include <Wire.h>
descriptor :
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0,SCL,SDA,U8X8_PIN_NONE);

and some links :

mardi 6 juin 2017

Jauge simple processing

Aujourd’hui ça chauffe !

Affichage d une jauge simple avec processing.

Un petit programme avec processing, tout simple, qui permet d afficher une valeur sur un écran.
J ai eu des contacts de personnes intéressées pour afficher ainsi des jauges sur un écran. L idée est de faire un morceau de code en processing, qui affiche une variable, et surtout qui est facile a adapter pour tout ce que l'on voudra. On pense a des paramètres moteurs (ULM) , mais ça peut servir a bien d'autres choses.

Ce qu il faut :
- Une valeur a afficher. En général, elle va provenir d'un capteur; une carte Arduino fera l affaire, ou un contrôleur de moteur, ou tout autre chose. En principe cela arrive par le port série, mais on peut penser a la modifier d une autre façon, capteur directement sur la carte, potard, bouton, etc... Mais ici, je ne décris pas cette partie la, j'aurai un autre sujet la dessus prochainement. Dans ce morceau de code, la valeur se pilote en montant et descendant la souris. Bref, elle est déjà la.

- Un afficheur : La aussi, débrouillez vous, il y a des solutions. Utiliser une carte Raspeberry Pi, ou un PC, ou tout ce qui peut faire tourner processing.

- Le code, entre les deux.

Tel quel, ce code affiche une valeur sur une zone de 200x200 pixels. Mais évidemment on peut penser a mettre plusieurs jauges cote a cote, changer les tailles des affichages, les couleurs, etc..
J ai bien documente le code, en principe tout est dedans pour l adapter.
Pour changer la taille de 200x200,  a autre chose, revoir quelques valeurs.
Les couleurs de fond et des zones sont également faciles a trouver et modifier.
L aiguille, soit une simple barre, soit un symbole plus evolue.
Dans cet exemple, c est une température qui va jusqu a 150 degrés sur 3/4 de tours. Bien évidemment, on peut changer tout cela a son gout.

En tout cas, c'est une bonne introduction a processing. Si vous ne connaissez pas, il y a d'excellents tutos en ligne et des exemples a foison. C est le moment.
Si vous venez du monde Arduino, tentez le coup! Installez la derniere version de processing.
Passez quelques dizaines de minutes sur les tuto. (Oui, c est de l anglais, bon, mais vous etes modernes...) C est de l open source, bien sur.
Ce n est pas si difficile que ca a maitriser. Les references et les exemples sont la pour vous aider.

La référence des affichages est a l origine en haut a gauche. Le truc est qu on modifie les origines de l affichage par des matrices (pushMatrix ..... code.....popMatrix) et tout ce qui est au milieu se trouve déplacé ou pivoté.