Olimex ESP8266 module – MOD-WIFI-ESP8266-DEV

I need a bigger flash and a breadboard friendly board. Quick research lead to the following variants, beside soldering a bigger flash on the ESP-XX series modules.

  1. NodeMCU board’s that have bigger flash and fit on a breadboard but have regulators and usb 2 serial on them.
  2. ESP-XX module with adapter,  don’t like .
  3. MOD-WIFI-ESP8266-DEV

And the winner is Olimex’s – MOD-WIFI-ESP8266-DEV .

i got some of them:

oli6

Cardboard boxes and the modules within packed in real anti static bags.

antistatic-web

 

I’ve soldered the headers, with chip on top – looked natural. But the GPIO  silkscreen markings got hidden at the bottom of the module – i think it’s better for development to have them on top, shorted out text is OK.

oli3 oli4

There are  two rows left on both sides of the the breadboard.

oli1

So, let’s see what the extra flash is good for.

SSL – Is SSL the right solution for #IoT?

FOTA  – What about the FOTA upgrades security?

Going down the rabbit hole it seems that the MOST important and hard part of a IoT implementation is to get the security right. So the extra flash will present an opportunity to test to some ideas on how to do it. And we need it for the service we are building – it’s just vital to have and to have it right.

esp8266 UDP debugging

After a lots of lots of wasted hours  debugging an I2C driver it came out that the noise from the connected cheep USB2TTL converter is way too much. Would have lost months without the help of the new DS1054z scope i’ve got.

So i came up with this – a simple UDP debugging.

Simple socket to send udp messages.

dbg

Call dbg_udp_start(0) and you are ready to go. If you prefer not to flood your LAN with debug messages broadcasts then instead of 0 provide your workstation IP address.

Them usage is as simple as:

dbg_udp(“My debug message\n”);

You can go and wrap your os_printf or whatever calls to send via UDP too.

Viewing the log is done by any netcat alike.

nc -l -u -p 20202

It’s going to be handy when the UART is talking to other devices. You can even debug your devices over the internet this way.

 

 

Rigol DS1054Z

I’ve got a new tool at the LAB!

The Box: rigol_ds1054z_box

 

 

The Tool:  rigol_ds1054z_web

 

Having an oscilloscope is just priceless. You may need it rarely but there are times when you are just lost blind  without it. The video lists all you should now about it and a bit more

If you are considering to get one and you are in EU. I can recommend Silcon.cz – you will get a nice service there.

Still learning it features.

Three/Mono Phase Asynchronous Motor Simulator

When repairing stuff with a motor  the first question is:

“Is it the motor or is it the board that failed?”

For a recent Inverter Air Conditioner  board repair the following tool helped to answer that question.

 

sch

Simulate the circuit

The circuit can act as Induction Motor aka asynchronous motor .

Inverter Air Conditioners which use AC motors take the 220V from the grid and turn them into about 150V three phase AC which drives the motor.

So to test if the board is OK, connect the device in the place of the motor and see if the leds are flashing. /If leds are placed in a nice circle you actually see how the motor rotates/.

You can test if the mono phase motor is powered too – only the leds flash two by two not in circle.

It can be build in quite small box and is handy when doing work on the field.

 

ESP8266 – easy interrupts

While working on a current project i’ve faced an issue with code reuse. Espressif sdk allows only one interrupt handler for all GPIOs. That’s fine for monolithic code but since we like modular code a dispatcher comes handy.

The little inconvenience i’ve had was like this. I wanted to use the drivers/key.c code but it does use the data argument , so i’ve had to modify it to use a global variable. So i can call it from my own interrupt handler. And that is ugly.

So the lab have a brand new GitHub Account – where i’ll share code.

And the remedy for the issue –  new project: esp8266_easyintr .

May need a tweek or two.  I’ve  extracted it from a wip project.

Usage:

ei_init(); // init easy interrupts
ei_attach(GPIO_NUM, GPIO_MUX, GPIO_FUNC, module_isr, module_data); // setup  handler

You can attach only one per GPIO . You will get your data at the isr and you can have a proper code separation.

 

KiCad change fields visibility utility

$ open devlog

I’ve back imported footprints for a .cmp file and I’ve misunderstood  kicad’s question about the imported footprints visibility, so all went visible.

And surprise, you can not edit visibility for all fields at once.

So  little utility was born – fixvis.

Usage is pretty simple:

./fixvis file.sch fieldid newval
fieldid:
0 - Reference
1 - Value
2 - Footprint
3 - Datasheet
4+ - custom
newval: 0000 = visible, 0001 = hidden

Example hide all footprints:

./fixvis name.sch 2 0001 > name-nofp.sch

It would be good to have a global toggle option.

$ close devlog

73!

Apache websockets with proxy_wstunnel and mosquitto

Spend last weekend trying to make apache with proxy_wstunnel to work.
The solution recommended is to add this in the apache config:

ProxyRequests off
ProxyPass /mqtt ws://127.0.0.1:8082
ProxyPassReverse /mqtt ws://127.0.0.1:8082

But no matter what it is a no go. So, where is the problem?

It’s the libwebsockets it doesn’t understand custom http headers X-… but apache adds some.

To add support for them in the file lextable-strings.h append before the blank string :

"x-forwarded-server",
"x-forwarded-for",
"x-forwarded-host",

Then do compile and install:

gcc minilex.c -o minilex && ./minilex > lextable.h
gcc minilex.c -o minilex && ./minilex > lextable.h
make && make install

Yes, do it twice. You must have a working apache2 with proxy_wstunnel module talking to mosquitto broker.

Now let’s get on the mqtt stuff.

P.S. The proper fix is to ignore all custom headers as per the HTTP specification and not consider them dangerous.

ESP8266 – The Little Beast!

esp8266ex

The esp8266 chip is made by Espressif Systems.

ESP8266 is a highly integrated chip designed for the needs of a new connected world. It offers a complete and self-contained Wi-Fi networking solution, allowing it to either host the application or to offload all Wi-Fi networking functions from another application processor.

The chip have both certifications FCC and CE. You can sell your products to the mass market.

  • The FCC identifier : 2AC7Z-ESP8266EX
  • The CE opinion number : TCF-1933CC14

Internet of things survey from an year ago at Wi-Fi.org shows very big numbers for smart enabled devices.

Why WiFi for the Internet of Things A.K.A Smart Devices?

Two words – security and availability.

While WiFi is know to be at the edge of the secure protocols it offers much more protection than regular 315/433Mhz devices. 2.4GHz keyboards were hacked recently too.

There are two main types of data that the IoT  devices process:

  1. Sensor Data – It may be sensitive or not but can only be used for analysis. Can cause trouble but only indirectly.
  2. Actuators Control –  If hijacked can make a real mess – what if you use a wireless door lock?

WiFi and the esp8266 chip provide enough security with the TKIP and AES engines built in /is there ever completely secure system? / to control your appliances.

So let’s get started and build some devices:

Appliance Control Goals

  1. Control devices – turn on/off your oven/dishwasher/washing machine/coffee maker/whatever at predefined schedule or at your will.
  2. Collect usage data from your  appliances
  3. … ?

Environment Control Goals

  1. Monitor environment parameters
  2. Monitor presence
  3. Control environmental devices – lights,  blinds
  4. …. ?

It’s an open ended post which will get updated for sure.

But let’s put that little beast to work!