Go Down

Topic: replacing ESP32 with a Rasperry Pi Zero to run C++-Sketches on the Rasppery Pi (Read 505 times) previous topic - next topic

StefanL38

Hi,

right now I'm using a ESP32-board as the microntroller that runs code compiled with the Arduino-IDE.
The ESP32-board does switch some Relais connected over transistors with IO-Pins .
Of course I know an ESP32 is sufficient to to such a simple task of switching some IO-Pins.
Anyway I would like to  do the following:

replacing the ESP32 by another "microcontroller"  to run C++-Sketches

Still using the Arduino-IDE on my PC to write the code for the "microcontroller".  
"flash" the C++-Sketches to this other "microcontroller" so that the

C++-Sketches runs on this other "microcontroller".

Now your question will be what the heck is this other "microcontroller"?

I wanted to describe my plans this way to make very clear that I want to do something different than
running the Arduino-IDE on the Rasperry pi zero.

I DON'T want the Arduino-IDE run on the Rasperry Pi Zero. I want to run C++-Sketches on the Rasppery Pi Zero.

The ESP32 running shall be replaced by a  Rasperry Pi Zero shall to run replacement for C++-Sketches .

With googling  I found this manual
How to Run Arduino Sketches on Raspberry Pi

But it is a rather complicated manual process. Did somebody develop an additional JASON-Board-Data which could be simply imported through the board-manager of the Arduino-IDE?

@moderator:  If you think this questions fits better into another forum just MOVE the thread.

best regards Stefan
any newbee can apply the most professional habit right from the start:
 add only ONE thing at a time. Debug that ONE thing until that ONE thing works reliable - repeat.
Newbee: become a professional by following this rule.

PaulRB

Hi Stefan. Those are complex instructions on that link! I did something similar once myself. Video. But I did this by copying a sketch that I developed on the Arduino IDE onto a pi zero and amending (using nano editor) and compiling it (using terminal commands) on the pi using a library called "WiringPi" which allowed the gpio pins to be used via digitalWrite().

Before we go further, this could be an X-Y problem. So please explain why you want to do this. There may be a better way to achieve your true goal, if we understand what that is.

StefanL38

Hi Paul,
Quote
So please explain why you want to do this. There may be a better way to achieve your true goal, if we understand what that is.
very good answer. I have an ESP32 that works as controlunit for timed switching off mains-supply in my garage and for switching the dooropener. Right now a RFID-tag is hold close to the RFID-reader and if RFID-number is autorised open the door. The RFID-reader (ESP8266-bases)  sends an encrypted ESP-NOW-message to the control-unit. 
Recently I came across the app Blynk and did some first tests. 
Now I'm thinking about using Blynk on multiple smartphones to open the door.

In the Blynk-app you can define your own user-interface with buttons, sliders etc. You get 2000 "energie-units" for free.  Each functionality costs "energie-units" a simple ON/OFF-button 200 units. So the 2000 units for free are used pretty quick. Buying more units is quite expensive.
Even if you buy a great amount to get the single unit cheaper a simple on/off button is 20 cent.  Displaying a status-info 80 cents etc.
There is a possability to setup your own local Blynk-Server for free. Therefore I would like to use a Rasperry Pi Zero.
The Rasperry Pi Zero shall still do all the rest of the control-functions. If there is a possability to transfer my already written C++-code to the Rasperry Pi Zero this would be great.


But you are right. I have posed the same question as you too when reading postings. And of course there are multiple ways to achieve the same functionality. One way would be to use the Blynk-bridge functionality with which two microcontroller-devices can communicate over the Blynk-Server. 


Maybe in the future I will setup an MQTT-server or even an OpenHAB-server to connect much more things.
Then I guess it will be better to use a Rasperry Pi 3 because of it has more RAM than a Rasperry Pi Zero


So the what I want to achieve is sending commands from multiple smartphones to this  control-unit. Which 
is momentary based on an ESP32. Ideally by just starting an app and tipping on buttons in the app.


best regards Stefan
any newbee can apply the most professional habit right from the start:
 add only ONE thing at a time. Debug that ONE thing until that ONE thing works reliable - repeat.
Newbee: become a professional by following this rule.

Pagus

https://create.arduino.cc/getting-started/raspberrypi/welcome

You can try this but when I tried it a few years ago, it was not ready for real world use. I have no idea what has happened since then.

PaulRB

I believe you can use raspberry pi as a Blynk node. Usually this is coded in JavaScript, but I read that C++ is also possible. Perhaps such a sketch can be run at the same time as using the pi as a Blynk server, because they would be separate processes running in Linux.

Perhaps you will find more expert help about this on the Blynk forum?

StefanL38

Hi Pagus and Paul,

thank you very much for your answers
best regards Stefan
any newbee can apply the most professional habit right from the start:
 add only ONE thing at a time. Debug that ONE thing until that ONE thing works reliable - repeat.
Newbee: become a professional by following this rule.

Go Up