how to send data from esp32 to raspberry pi using wi-fi - raspberry-pi

i hope you're doing great !
I'm currently working on a project from long time ago and honestly that was depressing for me , well i'm going to share with you the idea and the progress I made through the past 5 weeks and hope if you someone of you can lead or help me ,
so the idea is I'm currently connecting esp32 Arduino board with temperature sensors (dht22) ,
I'm able to connect this sensor to esp32 and read all the values on the serial monitor .
now my next step that I didn't know how to do is :
I want to send the serial monitor data continuously every 2 min to the raspberry pi via the wi-fi , i want to program those data to be seen on thingsboard .
thank you so much !

You can use MQTT method to send your esp32 data to the desired computer or multiple computers. Install the MQTT broker software in the raspberry. Connect the esp32 to that MQTT broker and publish your data to a specific topic. In the application you can connect to the same broker and subscribe to that topic and receive the data stream.

Related

I'm getting USBD_BUSY when i try to transmit sensor readings from sensor to my computer via virtual com port

I'm trying to transmit MPU6050 sensor readings to my computer via virtual comport.I'm using STM32 Nucleo F446RE. As far as i can see in debug mode there is no issue in sensor and sensor readings. Problem is I can't transmit them using USB. Are there anyone who have experienced this issue before?
In the tutorial I watched the guy can transmit sensor reading with USB port and can see them with a serial port reader program. I'm sure that there is no issue in sensor the card sees sensor. I don't know why it keeps returning USBD_BUSY.
Transmit Code I'm using

How to receive file or images using MQTT and ESP8266

I am developing a ESP8266 based project that will be able to communicate with MQTT server (publish and subscribe) ,I'll also need to make files receives from MQTT server .
It is possible to do this with ESP8266 and MQTT ?.I had searched on Google and but I didn't get very clear answers. Can anyone suggest be better solution?

How do I create a Near Edge computing system? (Send sensor data with Raspberry Pi/DHT11 sensor)

I am working on edge computing for IoT applications and expected to create a system that acts as a near edge computer with the use of a raspberry pi hooked up to a dht11 sensor. How do I send this data over to a computer that is at the edge? Ideally I want to use my PC as this device but I have no clue how to send this data over in real time.
So far I have created the circuit and can view the temperature and humidity readings on the raspberry pi in python. Unsure of what the next steps are - I don't want to send this data over to the cloud just yet.
Side note: I believe i may be missing knowledge regarding this but is the raspberry pi an edge device because it is hooked up to the sensor directly?
Any help is greatly appreciated.
You need to think this through a bit more. What will you do with the temperature and humidity data that you receive?
For example, if you're just experimenting and want to just see the readings in a console on your PC, you can use netcat to send the console output of your Python program from the RPi to PC. No SW development needed, they just have to be in the same network. Not particularly useful for anything else, either.
Otherwise you need to set up some client-server solution between the RPi and your PC. There's a ton of possible solutions, all depending on what you plan to do with the data. You can use MQTT, HTTP, a straight database connection (MySQL, PostgreSQL), etc. You have to supply both sides of the connection. The Python code on client side which connects and sends data; and the server side thing that accepts the samples and stores them somewhere. Plus all the networking, authentication etc.
Or you can just download the Python client libraries for your favourite cloud solution and set that up according to a tutorial. TBH, this sounds a lot less work to me.

How to model and simulate sensors that will send data to raspberry pi?

I am trying to establish communication between laptop and RPI. So far, I have used python and socket programming to do that. Now, instead of using actual sensors, I want to simulate sensor behavior by which sensor data can be sent from laptop to RPI.
So far I came across some options to do it:
Using IMB Bluemix IoT simulator or
Using simple python scripts to create sensor data or
Using simulink sensor models
Can anyone give me a better idea or any comment about these options please?

Registering Raspberry Pi with IBM Bluemix

I registered my Raspberry Pi with IBM Bluemix successfully . It has dht22 temp and humidity sensor connected to it and running.
Question: While building Internet of things starter app , do i need to code anything on Rpi to push that sensor data into Bluemix or simply providing the MAC address and the API will do the trick?
Note: I followed a recipe to configure my Raspberry Pi , registered with the MAC address. It is connected and sending messages when i check in the device.
Kindly let me know if i need to do any other configuration or coding to send specifically my dht22 sensor data to visualize in Bluemix and use it in Node-red.
By default Raspberry Pi recipe sends only the CPU temperature and CPU load. As there are no sensors present in Raspberry Pi by default, the recipe uses parameters like CPUTemp and CPULoad.
In your case, you will need to update the code to include dht22 temp and humidity parameters to be sent to IoTF(Bluemix). Please check the code in Github for the raspberry Pi recipe - https://github.com/ibm-messaging/iot-raspberrypi
Navigate to samples/c for the recipe code. You will have to gather the dht22 sensor data and convert them to JSON and send it to IoTF.
In the iot.h, update the json struct to include your sensor values. You can remove the cputtemp and cpuload parameters if you dont need them.
In iotmain.c, line 152 update the code with the code to gather the dht22 sensor values.
In jsonator.c, update the new sensor values based on your new struct.
Then follow the steps provided here to compile the code and install the new deb file. Now the iot service will send data with dht22 sensor values.
If the Bluemix IOT console is showing the that the device is connected and sending data then you should not need to do anything more on the Raspberry Pi.
You will need to bind the IOT service to your Node-RED instance (assuming you are running Node-RED on Bluemix) to access the data.
I believe the recipe you used was this one: https://developer.ibm.com/iot/recipes/raspberry-pi/
Per the readme in the source code, the events that are emitted in this sample are:
CPU temperature
CPU Load
Simulated Sine wave to demonstrate the different events can be pushed to IoT Portal and visualized.
If you are trying to capture other items such as humidity you may need to create additional code/logic.
I have an ansible role to register raspberrypi, fyr
https://github.com/reachlin/fangge/tree/master/ansible/roles/iot
You have to replace your credentials in file defaults/main.yml
ORG:xxx
TYPE:xxx
ID:xxx
AUTH:token
TOKEN:xxx