All posts by rob

WiFi scanner with ESP32

Use an ESP32 to get the best performance with your WiFi router.

For the best performance with your WiFi router, you should choose a wireless channel less used by any of your neighbors. Many routers use the same channel by default–e.g., 6–and unless you know to test for and change the Wi-Fi channel when you first install your router, you’re probably using the same channel as someone else nearby. In other words, decreased performance.

Here the script for the ESP32 to scan your neighborhood WiFi access points.

Here an example output from my neighborhood:

scan start
15 networks found
1: robnet2 (-54) [13] WPA2_PSK
2: woodfamily2 (-85) [2] WPA2_PSK
3: VGV7519DFC699 (-85) [6] WPA_WPA2_PSK
4: woodfamilyGuest (-86) [2] WPA2_PSK
5: FRITZ!Box 7581 MO (-87) [6] WPA2_PSK
6: Ziggo beneden (-89) [1] WPA2_PSK
7: Infinity (-89) [6] WPA_WPA2_PSK
8: Ziggo (-91) [1] WPA2_ENTERPRISE
9: Ziggo (-91) [11] WPA2_ENTERPRISE
10: Ziggo (-92) [1] WPA2_ENTERPRISE
11: Infinity (-92) [11] WPA2_PSK
12: FBI surveillance van (-93) [6] WPA_WPA2_PSK
13: Ziggo39330 (-94) [1] WPA2_PSK
14: Eightball’s network (-94) [6] WPA2_PSK
15: DIRECT-8E-HP ENVY 4520 series (-96) [6] WPA2_PSK
scan done

Change the Wi-Fi Channel on Your Router

Once you know the wireless channel that’s least congested near you, head to your router’s administration page by typing in its IP address in the browser address bar. Depending on your router, this will likely be something like 192.168.2.1, 192.168.1.1, or 10.0.0.1 (check your router manual or the bottom of your router for details).

Head to your router’s wireless settings to change the Wi-Fi channel and hit apply for it to take effect.

ESP32 HW-607

See also my other page using the ESP8266 / Wemos D1 Mini as WiFi scanner

freenom.com

My BAD experience with freenom.com

I had some domains registered at freenom.com

1 domain was taken from my account after about 3 month, and was pointed to random advertisement sites.

Another domain was removed from my account after about 7 month and is now for sale at freenom.com. It was not heavily used (about 5 hits a day)

If you your domain is not used many times, then you will be lucky to keep it for 1 year. But don’t forget to renew your domain in the last 2 weeks before expiring or you will loose your domain.

So it looks like freenom.com only gives out free domains for a short period of time.

I will move the remaining domains I have with them to my own domain where I will create a few more sub-domains.
This will be the only possible way to know that your site won’t disappear from the internet.

ESP32

Not all pins of the ESP32 can be used.

Below a list of all special pins of the ESP32

  1. The application can use ADC2 only when Wi-Fi driver is not ESP32 HW-607started, since the ADC is also used by the Wi-Fi driver, which has higher priority.  GPIOs 0, 2, 4, 12 – 15 and 25 – 27
  2. Some of the ADC2 pins are used as strapping pins (GPIO 0, 2, 15), so they cannot be used freely.
  3. ESP32 Core Board V2 / ESP32 DevKitC: GPIO 0 cannot be used due to external auto program circuits.
  4. ESP-WROVER-KIT V3: GPIO 0, 2, 4 and 15 cannot be used due to external connections for different purposes.
  5.  The hall sensor is internal to ESP32, reading from it uses channels 0 and 3 of ADC1 (GPIO 36 and 39). Do not connect anything else to these pins and do not change their configuration. Otherwise it may affect the measurement of low value signal from the sensor.
  6. Pins 34-39 are input only
  7. GPIO 6-11 are used for the flash, so you can not use them.
  8. Serial0 is on GPIO 1 & 3 (TX RX). Serial2 on on GPIO 17 & 16 (TX RX)
    Serial1 is per default on GPIO 9 & 10, but there are used for Flash.
    You can modify Arduino\hardware\espressif\esp32\cores\esp32\HardwareSerial.cpp to assing different GPIO pins.

Build a MP3 player with DFPlayer and an Arduino

Using the DFPlayer

It is quite easy to build your own MP3 player with an Arduino and a DFPlayer miniDFPlayer module.

You can buy the DFPlayer module on aliexpress or ebay for about 1,5 Euro.

I wanted he player to start playing the music as soon I connected the power on the setup, without pushing any buttons.
For this the DFPlayer has the busy pin. This pin will become HIGH when the player is idle. As soon as the player is playing music the pin will become low.

I used the DFPlayer_Mini_Mp3 control library from github. (see the program code below for the details.)

The code used

The connections

Below the schematic I used for the connections between the arduino and the DFPlayer.
Connecting the DFPlayer mini

WiFi scanner with Wemos D1 mini

For the best performance, you should choose a wireless channel less used by any of your neighbors. Many routers use the same channel by default–e.g., 6–and unless you know to test for and change the Wi-Fi channel when you first install your router, you’re probably using the same channel as someone else nearby. In other words, decreased performance.

Wemos D1 mini

Find the Best Wi-Fi Channel Number

You can use the ESP8266E which sits on the Wemos D1 mini as WiFi scanner to check which channel to use for your own home WiFi setup.
You do not need any additional hardware to make the WiFi scanner.
With the WiFi scanner you can check which WiFi channels are mostly used in your neighborhood, and with what strength they are.

Here an example output from my neighborhood:

scan start
16 networks found
1: NETGEAR08 (-88) [1] CCMP
2: HZN243330904 (-92) [1] CCMP
3: Ziggo beneden (-88) [1] AUTO
4: NETGEAR54 (-87) [3] CCMP
5: ThewoodfamilyGuest (-86) [3] CCMP
6: REMOTE25teeh (-94) [3] CCMP
7: Ziggo23355 (-91) [6] CCMP
8: robnet5 (-93) [6] CCMP
9: Ziggo (-93) [6] ?
10: Ziggo (-91) [6] ?
11: TP-LINK_2DEE (-84) [6] CCMP
12: ASUS (-92) [6] CCMP
13: H368N0E860E (-90) [8] AUTO
14: FRITZ!Box 7581 MO (-91) [10] CCMP
15: robnet2 (-44) [11] CCMP
16: Ziggo19179 (-87) [11] TKIP
scan done

Here the code that gives the above output

Change the Wi-Fi Channel on Your Router

Once you know the wireless channel that’s least congested near you, head to your router’s administration page by typing in its IP address in the browser address bar. Depending on your router, this will likely be something like 192.168.2.1, 192.168.1.1, or 10.0.0.1 (check your router manual or the bottom of your router for details).

Head to your router’s wireless settings to change the Wi-Fi channel and hit apply for it to take effect.

See this page for a WiFi scanner with the ESP32

Setting up WordPress for Multisite and Multidomain

Multisite & Multidomain

Since Version 4.8 WordPress includes not only multisite, but also multidomain.
There is no extra plugin is needed anymore, as soon as you enable multisite, multidomain is also enabled.

Enable Multisite

To enable multisite you need to edit your wp-config.php file.
You need to add the following  code to your wp-config.php file just before the /* That’s all, stop editing! Happy blogging. */ line.

Save this file on your server, and multisite is enabled on your WordPress installation.
Now you need to disable all your plugins before we activate the multisite option. (You can enable them again later)
When they are all disbled go to Tools >> Network Setup to activate multisite.
Choose option Sub-domains.
And fill in the Network Title & Network Admin Email
When all filled in click on the Install button.
WordPress wil now show you some code that you need to add to your wp-config.php and .htaccess file.

Enable multisite and multidomain in WordPress

After you have added the code and saved it to your WordPress installation you will need to login again.

You can now enable your plugins again which you disabled a few steps ago.

Your WordPress installation has now Multisite enabled and you will see a new menu item “My Sites” in the admin toolbar.

Wordpress Multisite and multidomain

You are now able to add a new sites and new users to your WordPress setup.

Click on Sites >> Add New to add a new site to your WordPress setup.

Wordpress multidomain

Here it still looks like you are not able to add a new domain.
But just fill in these 4 fields and press Add Site

You can add an admin email address other than the one you are currently using to manage your multisite.

If the email address is not currently in use by another user, then WordPress will create a new user and send the password and username to the email address you enter.

Enable Multidomain

To use different domains go to My Sites >> Network Admin >> Sites
Hoover over the site where you want to use your new domain and press edit.

You can now edit the  Site Address (URL) field and enter your new domain in it.

Make sure that the DNS server of your new domain has the correct IP address of your WordPress setup, and that your webserver points to the correct directory. This should be the same directory which you use for your first site.

You can now browse to your new wordpress site, and it should show it’s welcome site of the plugin used.
Most of the time you will not be able to go to the admin pages at this moment. You will see an error messages like this:

To solve this problem add the following line to your wp-config.php file just under the lines you added to enable Multisite:

Now your WordPress Setup is Miltisite and Multidomain enabled.

 

Setting up the Orange Pi Zero with XFCE Desktop

 

I am playing a bit with the Orange Pi Zero.
I want to use it as an internet browser with Firefox to surf on the Internet, without any problems to get an virus on my main PC.
Orange Pi Zero
Check which packets are already installed

Show all available packets

Handy tools to install on Orange Pi Zero

Setup XFCE GUI on the Orange Pi Zero

Add swap space

Enable and setup the WiFi with the command prompt

To add keepalive to your SSH sessions:
Add the following line to /etc/ssh/ssh_config file:

When trying to copy some data (About 25Mb) the connection over the WiFi , it suddenly stopped. When using the fixed Ethernet the problem does not show.  When using the WiFi without big data transfers the problem also does not show. Even not when running for a longer time with total more then 50Mb.

Air Quality with MQ-135 and Wemos D1 mini ESP8266

Measure Air quality with MQ-135 and ESP8266 Wemos D1 mini

As the MQ135 is not  really suited as a CO2 sensor (See my previous blog) and I still wanted to use it, I will use it as an air quality probe on an ESP8266.

As the title mentioned I will use an ESP8266 connected to my local WiFi router for this to send the data to thingspeak.com.Image of the Wemos d1 mini ESP8266 module
The ESP8266 I use is the Wemos D1 mini. The Wemos D1 mini has an USB interface and can be programmed with the normal Arduino GUI. You can add the board to it. See this article for how to add this board to the GUI.

I also use an DHT22 (AM2302) in this project to measure temperature and dht22 connectionshumidity. The DHT22 data pin is connected to pin D5 of the ESP8266 in my project. VCC is connected to the 5V of the ESP, GND is connected to GND.  You can of course any digital pin you want in your project. Just change line “#define DHTPIN D5” with the pin number you want.

For the MQ-135 you can only connect it to pin A0, as this is the only analog pin on the ESP8266.

For the air quality I store the lowest measured value in the EEPROM, so anything worse/higher that this best value is bad air quality. I use variable a1 & a2 & a3 to check if it is an new ESP8266, if these value in EEPROM are different than the stored values I presume that it is a new ESP and then set the lowest value to 510, if the values are the same I do not change the lowest value in EEPROM.

Below the program I use for this project.
I will try to describe any main step of it.

As there are some problems copying the below text I have added download links at the bottom of this page.

If you only want to use the MQ135 without the DHT22 then use the code below.

Download links.

Microsoft Explorer and Microsoft Edge seems to put this on one unusable line.
But Firefox and Google Chrome are both working.

MQ135_DHT22_ESP8266.ino
MQ135_ESP8266.ino

shop at aliexpress

Measure CO2 with MQ-135 and Arduino Uno

Measure CO2 with MQ-135 and Arduino

I had bought 3 MQ-135 gas sensors on AliExpress to test if it is possible to measure CO2 with them.

First I started with a very simple analog read to check the values in my computer/hobby room with a CO2 ppm around 650.

 

24 hours Burn-In

mq135
I connected the 5V power to the sensors and let them alone for 24 hours to burn in.

After these 24 hours I checked the values measured with the above little test program.
The values were 13 – 32 – 55
Breathing on them gave very little difference, as the values were only doubled to 28 – 61 – 103

With these values you can say that the first two are useless to measure CO2 as the difference is to little.
13 – 28 for CO2 ppm of about 500 – 2000 gives a resolution of about 100ppm/value measurement
32 – 61 gives about 52ppm/value
55 – 103 gives the best resolution of about 31ppm/value

These resolutions are valid if the scale is lineair, but the scale is logirithmic.
So in the lower ppm part the resolution is much better, but above the 1000ppm the resolution will be very low.

Wrong hardware

mq-135-2
Found out that the resistor towards ground was just 1K ohm, after replacing the resister with one 22K ohm the results were getting much better.

In my room s the real ppm was about 770 ppm according to my NETATMO.

The raw value measured with the arduino was now 241.
Using MQ135-master from G.Krocker site and modifying MQ135.h with the correct RLOAD resistor value of 22K and a RZERO of 879.13

and using the below Arduino code

The Arduino sends out the following output to the serial port.

With these values I am very close to the values of the NETATMO
I will of course also run the calibration outside where it should show about 400ppm, and eventually adjust the RZERO in MQ135.h

Next day

The next morning ppm was down to 500 according to the NETATMO, but the arduino showed a ppm of 600. I change the RZERO to 819 and the arduino also showed 500.

This is no good of course, so something must go wrong in the calculations in the MQ135 library. Or I am using a MQ-135 sensor with a bad response curve.

The next day I have tested the same with another MQ-135, but the results were about the same.

Wrong formula in the MQ135.h library

The formula to calculate the resistance of the sensor is wrong.
It should read:

MQ135 not suitable for CO2

I think that I will stop my attempts for using the MQ-135 as a CO2 meter. With 1 sensor I measured different voltages on the analog port with same amount of CO2. It probably is to responsive to other gases in my surroundings. (Airport and highway).
One evening while my wife was one floor lower and took some perfume the ppm went sky high from 640ppm to 5570ppm, and then slowly (30 minutes) went down again.

I think that I will connect it to an ESP8266E to measure the outside air quality and sent the data over WiFi to thingspeak.com .