1of! Platform for developing ESP8266 devices

[ 291 views ]
Developing hardware almost always run through the same stages:

  • It starts with an idea
  • You design a concept on paper or in your head
  • Using a solder-less breadboard you connect parts to see that it works as you hoped it
    would
  • Depending on the number of units you need, you either design a PCB or you copy the
    breadboard schematic to an experiment board
  • Task fulfilled! You can sit back and relax.

If you, as I do, regularly design devices with ESP8266 processors you run into the same pitfall every time. The form factor of the ESP8266 (f.i. the ESP-12) is not specially breadboard friendly.

Bringing the ESP8266 to the Breadboard

If you use a 400 holes breadboard (90x65mm) almost 33% of the available space is needed for an ‘ESP8266 on a piggy board’ and more alarming: There are no holes besides the piggy board to connect wires to!





If you use a Wemos D1 you also lose about 30% of the available space, but at least you have the luxury of one row of holes on both sides of the Wemos D1.






But if your favourite is the NodeMCU board the numbers are even larger.
You lose 60% of the solder-less bread board!






And why? If you want to design a device with an ESP8266 you always need a basic schematic just to operate the ESP8266. It is contra productive to set that up on a breadboard just because you want to interface a view passive or active components to make your idea work.

To sum it up, you need:

  • five resistors
  • two push buttons
  • a voltage-regulator
  • circuitry that delivers the 3v3 needed by the ESP8266
  • a pin-header to upload firmware to the ESP8266.

A total of ten – eleven components that évery ESP8266 design needs.
And yes! there are benefits in using a Wemos D1 or NodeMCU board for the fact that they have all the hardware I described before ánd they have an USB to Serial chip on board. Because of that chip you can easily program these boards by just connecting the USB cable to your computer and press the upload icon on the Arduino IDE.

But…they are way to complex!
If you design a device with a ESP8266 you almost certainly do that because of the WiFi functionality of that processor. And once you have configured the WiFi settings you don’t need the USB to Serial chip anymore. Even updating the device with new firmware can easily be done “Over The Air”! So, if you want to develop a device with an ESP8266, the USB to Serial chip will make your design much more complex and more expensive, you need special skills or tools to solder the chip on a PCB and you will probably never use the functionality in real life devices.

And there are more arguments not to use these bulky boards for developing your own devices (apart from the fact that it is far more satisfying to design everything yourself). For instance if your device needs the ESP8266’s Analogue to Digital Convertor (ADC) and you start of with the Wemos D1 you need to know there is a voltage divider on the Wemos connected to the ADC pin and you have to make sure you use the same voltage divider in your overall design. And I get so confused by the naming of the IO-pins. You have the physical pin number (is pin 1 on the left top or ..), the made up ‘D-number’ and the underlying GPIO-number. Why?? And you can solder the pin-headers on the Wemos D1 with the ESP8266 on top or on the bottom. That messes up the physical pin numbering quit a lot!

Therefore I designed a solution that can be used as a development platform with a breadboard an experimenter board or an “one of a kind” end product.

Lets bring the Breadboard to the ESP8266

What I have done is made a processor board with an ESP8266, USB power, 3v3 regulator, a view resistors and elco’s, a Reset and Flash button and a 20 pole connector with all the available and usable pins from the ESP8266 plus GND, 3v3 and 5 volt power lines. You can choose to power the ESP8266 by soldering either a micro USB-B connector to the board or an ‘Arduino UNO’ large USB-B connector. To flash the ESP8266 you need an ‘USB to TTL’ cable or a simple USB-programmer and connect the ground, TxD and RxD to the programming header on the processor board (the 1of!-ESP12 can also be powered by the programming header if you apply 3v3 to the connector). To set the ESP8266 in flash-mode you press the flash-button and hold it pressed. Then you press the reset-button, release the reset-button and then release the flash- button. The ESP8266 is now in flash-mode and stay’s that way until you have uploaded your sketch or until you press the reset-button again (and if you program well, you can upload sketches wirelessly -‘Over The Air’- and never have to push buttons again).

The 20 pole connector has all the GPIO-pins 01, 02, 03, 04, 05, 12, 13, 14, 15 and 16 in that order so you never need to check what physical-pin is what ‘D-number’ is which GPIO-pin!

If you connect something to GPIO05 you program pinMode(5, mode) and digitalWrite(5, state) or digitalRead(5)!

SP1 and SP2 are not connected to anything but if you know what you’re doing and want to use GPIO09 and GPIO10 (which is not recommended) you can connect a wire from the ESP12 to these spare pins.


This board is called ‘1of!-ESP12’ and once you have one of these you can connect it with a ‘1of!-Proto’ board and start prototyping.











There is also a 1of!-Wemos board and there are two 1of!-Proto boards.











The smaller 1of!-Proto board has 18×22 (378) holes and the larger one has 25×22 (532) holes.









Small 1of!-Proto board connected to the 1of!-ESP12 with the ‘UNO’-like USB-B connector

On the bigger board you can solder a 20 pin female-header and glue a 90 x 65mm solder-less breadboard on it.

If you made your device on the breadboard or on the experiment board you can simply disconnect it from the processor board and start your next project on a new 1of!-Proto board or you can make it an “one of a kind device” and put your design in a standard box. If you made a killer-device you can convert your proto design into a real PCB by simply combining your own design and the simple basic ESP8266 schematic into a complete schematic in your favorite CAD program and create the PCB from there.

The whole 1of!-family (februari 2019)

I have made some instruction videos on how to make the 1of!-boards

Posted in Arduino, Computer, ESP8266, Hardware, WiFi | Tagged , , , , , | Leave a comment

Home-Assistant Integratie met de DSMR-logger

[ 522 views ]
Belofte maakt schuld. In mijn post over de DSMR-logger heb ik belooft om ook een post te schrijven over de integratie van Home-Assistant met de DSMR-logger.

Die belofte willig ik met deze post in.

Home-Assistant is, naar mijn bescheiden mening, één zo niet dé meest universele en robuuste Domotica oplossing die momenteel bestaat. De manieren waarop Home-Assistant gegevens uit andere systemen kan halen is bijna onuitputtelijk. Het is alleen zaak de voor jou beste manier te vinden.

Home-Assistant kan gegevens via een restAPI uit andere systemen (en dus uit de DSMR-logger) halen maar dat heeft als nadeel dat als je meerdere gegevens uit zo’n extern systeem wilt halen en deze allemaal beschikbaar worden gesteld via één restAPI deze restAPI voor ieder veld aangeroepen wordt en er dus héél veel data “over de lijn gaat” en het externe systeem ook vrij zwaar wordt belast.

Daarom heb ik, voor het uitlezen van de DSMR-logger, gekozen om Home-Assistant (HA) de gegevens uit een bestand (platform: file) te laten halen. Dat bestand staat op dezelfde computer waar ook HA op draait waardoor de overhead wordt geminimaliseerd.

Het werkt zo:

Middels een python programma doen we een request naar de DSMR-logger om de actuele gegevens van de Slimme Meter te geven. Dit programma moet periodiek (zeg één maal per minuut) gestart worden. Dat is de taak van ‘cron‘. Cron is een Unix/Linux deamon die, op basis van tijd, jobs start. In ons geval moet hij dus het python programma “DSMR_Actual.py” starten.

Met het commando ‘crontab -e’ (als user root!!) kun je de volgende regel in crontab aanbrengen:

Het programma DSMR_Actual.py ziet er zo uit:

In regel 5 krijgt ‘url’ de verwijzing naar de restAPI van de DSMR-logger waarmee de actuele gegevens worden opgevraagd.
Regel 6 zet dit om in een request aan de DSMR-logger en regel 9 stopt het antwoord van de DSMR-logger in de variabele ‘r’ die vervolgens in regel 10 gedecodeerd in de variabele ‘response’ wordt gestopt. Uiteindelijk schrijft json.dump() de terug gekregen response naar het bestand ‘/tmp/DSMR-Actual.json’.

Dat bestand ziet er dan zo uit:

Om het geheel een beetje overzichtelijk te houden heb ik alle scripts die ik voor HA gebruik in de map ~/.homeassistant/scripts/ gestopt.

Vervolgens moeten we aan HA duidelijk maken dat ze de gegevens van de DSMR-logger uit het bestand /tmp/DSMR-Actueel.json moet halen.

Ik heb al mijn sensor-configuraties in de map ~/homeassistant/sensors gestopt. In het configuration.yaml bestand heb ik de volgende verwijzing staan:

Deze regel zorgt ervoor dat alle .yaml files die in de map sensors/ staan als configuratie bestand van de HA installatie worden geparsed en opgenomen.

Eén van de sensor configuratie files is DSMT_Actueel.yaml. Deze heeft de volgende inhoud:

Om deze gegevens ook daadwerkelijk op de front-end van HA te krijgen moet ook groups.yaml worden aangepast.

De Home-Assistant front-end geeft dan dit inzicht:

Posted in Scripts, Uncategorised | Tagged | 3 Comments

DONOFF – WiFi enabled light dimmer

[ 829 views ]

Part-1 – Introduction

Years ago I started building RF devices to measure temperatures and switching lights on or off. I even wrote a small book (in Dutch) about my findings and experiments. But I always wanted to overcome the main disadvantage of RF devices: no feedback about the status of the lights. I thought that could be done better and with the introduction of the small ESP8266 WiFi enabled processors it could! But SONOFF beat me with there WiFi enabled switches. One great disadvantage of the SONOFF devices is the poor software. To make the switches usable you have to upload third party (mainly Open-Source) firmware and install a Home-Automation solution to control the switches. Another disadvantage of the SONOFF switches is .. well they are switches (Switch On Off). So there is room for improvement!
 
Albeit: I introduce to you: DONOFF (Dimmer On Off)!

Keep on reading

Posted in Arduino, DONOFF, ESP8266, Hardware, SONOFF, WiFi | Tagged , , , , , , , , , | 8 Comments

DONOFF – WiFi enabled light dimmer (Part 2)

[ 553 views ]

Part-2 – The Electronics

This is part 2 of the four parts posts about the DONOFF ecosystem.

• Part 1 – Introduction
• Part 2 – The Electronics (this part)
• Part 3 – The Firmware
• Part 4 – Building a DONOFF device

In the first part I introduced the DONOFF ecosystem and the design goals.
In this part I will try to explain the electronics.

The hundreds of posts on the internet about mains dimmer designs all use a triac to cut-off part of the sine waves of the AC mains. Some do this by leading-edge cut-off, where the first part of the sine wave is cut-off:

Another method is by trailing-edge cut-off where the last part of the sine wave is cut-off:

As elegant and nice as these solutions may be, they only work with resistive loads (incandescent lights). You can, at least in the Netherlands, no longer buy incandescent lights and in the near future the only lights available will be LED lights.

You cannot dim LED lights by either trailing- or leading-edge cut-off! But (dimmable) LED lights can be dimmed with Pulse Wide Modulation (PWM). PWM switches the power to the LED light on and off at a (relatively) high frequency.

The DONOFF hardware uses this PWM to dim the (dimmable) LED lights but PWM can also be used to dim incandescent lights (So as a bonus, DONOFF can also dim incandescent lights).

Keep on reading

Posted in Arduino, DONOFF, ESP8266, Hardware, SONOFF, WiFi | Tagged , , , , , , , | 1 Comment

DONOFF – WiFi enabled light dimmer (Part 3)

[ 521 views ]

Part-3 – The Firmware

I will, in four parts, explain how you can build and use this DONOFF ecosystem.

In the previous parts I introduced the DONOFF ecosystem and the electronic design.
In this part I will present the firmware.

Prerequisite

You need the following to be able to compile and upload the DONOFF firmware to the ESP-01 board:

  • The Arduino IDE
  • The ESP8266 extension (2.4.2)
  • The ESP8266 Sketch Upload Tool installed
  • The PUYA patch

Most of the ESP-01 boards now for sale have a flash-chip that has some problems regarding reading the flash content. There is a temporary patch to overcome these problems (see here). It is absolutely mandatory that you install this patch in your toolchain!

Keep on reading

Posted in Arduino, DONOFF, ESP8266, Hardware, SONOFF, WiFi | Tagged , , , , , , , , | 1 Comment

DONOFF – WiFi enabled light dimmer (Part 4)

[ 751 views ]

Part-4 – Building a DONOFF device

I will, in four parts, explain how you can build and use this DONOFF ecosystem.

In the previous parts I introduced the DONOFF ecosystem.
In this part I will show you how to build a DONOFF device.

Warning: Any circuit that deals with MAINS VOLTAGES is inherently dangerous, and you should NEVER handle mains voltages unless you know exactly what you are doing. The DONOFF circuit is purely theoretical and offers no isolation or any safety features, and therefore, without modification, it does not constitute a safe circuit, or having practical applications outside serving as a proof-of-concept.

DONOFF dimmer PCB
If you still reading this I have one more warning: Whatever you do, do not build this circuit on a broad board!
You can build it on an experiment-board (use a board with pads on both sides) with proper soldering. But the best way by far is to use a dedicated PCB.

Keep on reading

Posted in Arduino, DONOFF, ESP8266, Hardware, SONOFF, WiFi | Tagged , , , , , , , , , | 5 Comments

Aan de slag met de ESP8266

[ 3,379 views ]

In deze post beschrijf ik hoe je de Arduino IDE voor de populaire ESP8266 processor-bordjes geschikt kunt maken. Hoewel al deze informatie gewoon van internet af te halen is blijkt het voor veel mensen, die de Arduino IDE of de ESP8266 bordjes net ontdekt hebben, overweldigend.

De ESP8266

De ESP8266 is een goedkope microprocessor met Wi-Fi mogelijkheid en een volledige TCP/IP stack. De ESP8266 is ontwikkeld en wordt geproduceerd door de Chinese fabrikant Espressif Systems uit Shanghai.
Door de geïntegreerde WiFi mogelijkheid is deze microprocessor in korte tijd razend populair geworden. In eerste instantie omdat de chip werd gezien als een goedkope mogelijkheid om een Arduino bordje van WiFi te voorzien, maar al snel kwamen de echte nerds (and I say nerds with the utmost respect) erachter dat de ingebouwde microprocessor en de hoeveelheid beschikbare (flash) geheugen de capaciteit en mogelijkheden van de Arduino bordjes verre overtrof.

Ga verder met lezen

Posted in Arduino, ESP8266, Geen categorie | Tagged , , | 7 Comments