Articles Hierarchy

Articles Home » Arduino Projects » ESP & Arduino

ESP & Arduino



What is the idea?
-5 restart win 7 PC new IDE
-4 and on RPI
-3 new brownout problem
-1 PID for ESP

use ESP & Arduino not ESP vs Arduino

again, if i work RPI or if i play ESP, the features are impressing,
but i miss the GPIO 5V world AND the Analog In. ( but possibly should recheck on ESP32 Analog I/O Quality )

as the ESP mostly got famous as WIFI dongle for Arduino ( serial port, AT commands )
what i actually never tried, it took some time to get that actually the ESP is (could be) the workhorse.

recently i play MQTT ESP8266 OLED ( to PRI MQTT broker Python service to sqlite3 database )
and RPI as webserver ( Flask ... Python )
now i want try to use that too on/from a ESP32 ( MQTT to RPI Broker ) ?problem?
but using real measuring data from a Arduino board.
If the ESP is just the

  • relay point for data to MQTTbroker ( and connected historic data sampling by python mqtt to sqlite3 )

  • or even run a application on the data ( like PID control )

  • and has its own webserver ( operator view/change ) like here

does not matter,
point is:
Arduino and ESP are the data collectors / controllers
but never used for historic data collection,
unless you have a very standalone application and upgrade with uSD Card.
here the MQTT could be perfect to send regularly PID: PV/SP/OVP/Mode or even event driven Alarming/Status for recording.

also in my first tests with the ESP32 i got stuck using it from Arduino IDE via RPI Linux, now also want try that again see here and here

i do not want to use the default serial because i will have connected USB to both boards, using IDE ( and monitor for diag prints )
so i will start with something like this, using softserial on pin 7/8 on both sides.
but i now read that actually ESP32 has 3 "hard serial" ( with free configurable pins )

and using for the 3v3 /5v problem a voltage divider like i see here

or use a add "breakout" board with this level shifter mos-fets, if i get it in time online.
as Rx Tx are strict one way easy,
the I2C.. as 2 way requires more ( and has a different HIGH definition of 0.7*Vcc =V5= 3.5V) see here
there is a whole world of solutions out there also with specialized ICs.. google it

i never see the idea to use 2 diodes in serial to reduce the voltage from 5 to ?3.6? but there
are many resistor diode examples, for pullup, limit with z-diodes...

also there is a upper range like with opto coupled ( potential free ) systems, what could be used for "measure at HIGH side"...

enough said:

restart win 7 PC new IDE

+ + Arduno IDE 1.8.5
+ + GIT update from here
try get Git- /stuck at end of download ( must be the new microsoft version already ) try again 38.7MB.
put the
at /hardware/espressif/esp32 ( sorry i do at IDE not at sketchbook but does not matter )
use windows explorer to start the git bash at /hardware/espressif/esp32/ ( open by context menu) and run
git submodule update --init --recursive
what not show me anything.
use windows explorer to start at /hardware/espressif/esp32/tools the
get.exe ( get " application" double click)

the mkspiffs subdir is new to me.

while the last public version in is esp_control_RPI_v13 from 30.8.2017
my sketchbook goes up to
esp_control_v15d from 20.9.2017 but using ESP8266 ?where i got stuck with temperature sensor?
and stopped working ( see also ESP / 8266 / 32 as WIFI Arduino, while the ESP32 is actually loaded with a old v1.3
compiling 1.5d for ESP32 on PC failed.
compile and upload v1.3 worked but the ESP32 looped booting with msg in serial monitor
"brown out detected"

same with simplewifiserver example, but when i connect to extra PSU webserver worked

what a difficult restart, so i am far away from my prior status, but i confirmed that the new PC Arduino IDE and the old ESP32 board are operational.

-4 and on RPI

ok, try ( again ) on a updated Raspberry Pi,
DEBIAN stretch
Linux version 4.14.34-v7+
Raspberry Pi 3 Model B Rev 1.2

following this
sudo apt-get install gcc git wget make libncurses-dev flex bison gperf python python-serial

mkdir -p ~/esp
cd ~/esp
tar -xzf ~/xtensa-esp32-elf-linux32-1.22.0-80-g6c4433a-5.2.0.tar.gz

nano .profile ( add at end )
export PATH="$PATH:$HOME/esp/xtensa-esp32-elf/bin"

check after reboot:
pi@RPI3:~ $ printenv PATH

follow this
cd ~/esp
git clone --recursive
cd ~/esp/esp-idf
git submodule update --init
( here i stop because i think that is somehow wrong ( and not for raspberry pi and arduino IDE )

again see here
arduino-nightly/hardware $ mkdir -p espressif
cd espressif
git clone esp32
cd esp32
git submodule update --init --recursive
cd tools
(reboot) and start Arduino IDE
find ESP32 boards, select simpleWIFIexample again and try compile:

or compile it all?
sudo apt-get install gawk gperf grep gettext automake bison flex texinfo help2man libtool libtool-bin git wget make libncurses-dev python python-serial python-dev python-pip
sudo pip install pyserial
cd ~/esp
git clone -b xtensa-1.22.x
cd crosstool-NG
./bootstrap && ./configure --enable-local && make install
./ct-ng xtensa-esp32-elf
nano ./.config #-- > Find CT_PARALLEL_JOBS=0 and change 0 to 1
./ct-ng build build.1 # start 10:23 ?auto restart 14:39 end 18:37
chmod -R u+w builds/xtensa-esp32-elf

so i see at 14:39 a auto restart of the build process?

end at 18:37 / about 8.2hours GRRRR.

if you read all the comments here and here looks that the
./ct-ng build build.1 should be just
./ct-ng build to avoid a double run.

ok, to get it run i try first copy:

but still compile error
/home/pi/Downloads/arduino-nightly/hardware/espressif/esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++: no such file or directory
move it again ( now into arduino IDE )
change the .profile change back and reboot and restart IDE
but still same error, right, there is no g++ file:

for a test i go here and download 77MB
and that content look completely different
copy that into Arduino IDE and now:
got a permission denied, try make it executable then got error
xtensa-esp32-elf-g++: error trying to exec 'cc1plus': execvp: No such file or directory
later i found i did copy from wrong dir: NOT /.build use /builds
so delete the downloaded thing and used the fresh compiled, but from the /builds directory
NOW compile and upload works:

-3 new brownout problem

BUT monitor also show brown out reboot looping

i need the serial monitor, my coding style requires one code line , one print line and
disable that diagprints later / or make it switchable by serial menu /
so digging how to disable that brownout thing:
here find:
#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"
void setup(){
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector

here i see


i try the change of the sketch first on PC,
could upload, see in monitor unreadable chars scrolling forever
could find the webserver when i used a extra PSU
but no way to find that port on PC (com25) again...
but from RPI i could upload old and new sketch again
and there even see the serial monitor:

so looks like i could start working again.
! pls. understand, this board did work one year ago very good from PC
with old Arduino IDE and old esp32 tools. ( but not from RPI at that time )

i do have now a RPI3B+ but thinking it is a different cpu from this RPI3B,
i should copy over to it for test / or build on it again? ( LATER )


while i checked on ESP32 news i see that the WEBSERVER
is still a open point, besides the basic one i learned a year ago that it is better to use ESP8266
code for this, but sorry i forget to document that one. But digging on dev status found recommendation for this but possibly its this
what i not see in BOTH is, HOW TO USE IT?
what i try first is to ( download ZIP ) and unzip/copy it to
let's see if it conflicts with existing libs. looks good, i could upload the advanced webserver example
from PC, but with many problems serial port and retries, and run it from extra PSU.

Now i try same from RPI. ( but already include the Disable_Brown_Out )

-1 PID for ESP

now i have to combine that with the ?latest? running version of my
PID.. and WEB Server for ESP 8266 AND 32
if possible also with all the #switches like
useAP useFIXIP from project: "esp_control_RPI_v13" from 30.08.2017 ( what could only be a ESP8266 version )
and from project "esp_control_v15e" from 20.09.2017 ( from PC using ESP32 ) already use SPIFFS and start with linked temp sensor...