Program Esp01 with a Raspberry Pi

Submitted bypatrik onSat, 2016-12-17 10:39

Connect module as in

sudo apt install picocom

sudo systemctl stop serial-getty@ttyS0.service
sudo systemctl disable serial-getty@ttyS0.service

sudo nano /boot/config.txt
Add enable_uart=1

sudo nano /boot/cmdline.txt
Remove console=serial0,115200

sudo apt-get install git-core
git clone git://

cd wiringPi

Remote on for Raspberry Pi

Submitted bypatrik onSat, 2016-12-10 17:34

This project is about to add a remote power on "switch" to a Raspberry Pi.
To switch the Pi on I use the connector "Run" on the board. If the two connections are shorted the Raspberry will power up. The plan is to use a BC547 transistor to short the pins. A ESP01 Wifi uC will control the transistor, make it conduct when a certain Mqtt-message has arrived.

ESP-01 "Al Cloud inside"

Submitted bypatrik onThu, 2016-09-22 10:56

Bought some new ESP-01:s, the version with the black board labeled "Al cloud inside" (here. At first I tried to talk to it via Arduinos serial monitor, connected the Esp via a USB-adapter (here).

Tried some different settings in the serial monitor, what worked was 115200 baud, both NL & CR:





ESP01 as wireless programmer

Submitted bypatrik onTue, 2016-08-02 16:04

Here we use a ESP-01 to program a Arduino.
The base is the Esp-link project,
I use a ESP-01 and connect it like this:
URXD: connect to TX of microcontroller
UTXD: connect to RX of microcontroller
GPIO0: connect to RESET of microcontroller

When using a 5V Arduino I use a resistor divider on the ESP:s RX as it's not 5 volt tolerant. 20k from Esp:s RX to ground, 10k to Arduino:s TX. No divider is needed on the ESP:s TX as it is an output.

Light sensing with a Raspberry Pi

Submitted bypatrik onThu, 2016-05-26 13:48

In a project I wanted to measure the amount of light in the room for controlling the backlight of a Tft display. The project uses a Raspberry Pi, which sadly don't have any analog inputs. In this case one can use a Ldr or a photo transistor with a capacitor. The principle is that you set a pin as output and make it high. This charges the capacitor. You then set the pin as input and measure the time until the Pi consideres the input to be low. The time this takes depends on how much light the detector is exposed to and will be a value depending on how much light there is in the room.

Light controlled tea light

Submitted bypatrik onSat, 2016-01-23 07:18

Electric tea lights are nice but they have a great disadvantage. There are small batteries in the base which dont last long and you have to replace them often. A modification is to remove the small batteries and add an external battery pack. The tea lights work on 3 volt, so two AA:s, rechargeable or not, will do.
I also tried to add a circuit that detects the light in the room and turns the light of at daytime, no need the have the candles lit then. The circuit is designed to draw as little power as possible, otherwise the gain of the power saving would be gone.

Measure light with an ESP01

Submitted bypatrik onTue, 2015-12-15 17:27

The goal of this project is to measure the light level in a room and send the value to a web server. One difficulty here is the lack of an ADC-pin on the ESP01 that is used. This is solved by letting a capacitor discharge through an IR-transistor, an idea taken from Pololu.
You have to remove the connection to Gpio2 when uploading firmware.
For running in stand-alone mode, remove the connection to Gpio0.


Submitted bypatrik onWed, 2015-08-26 11:20

I start by flashing firmware found here.

Then I can use the Arduino IDE to program the ESP. Ch_pd is connected to Vcc and Gpio15 to ground. To program, Gpio0 is connected to ground while the power is cycled.