Easy ESP32-ESP32 Communication (BOTH TCP & UDP Tutorials with trigBoard)
Vložit
- čas přidán 12. 09. 2024
- Kind of a long one here, but these methods can be used to easily communicate between ESP32s - I have been updating my "Ultimate Home Security System" to use TCP instead of UDP, and so decided to make a video here showing that. Sorry for the long rambling :) This could be perfect if you only want to send data between two devices and even for a lot of trigBoard projects, like if motion occurs in the back yard, you can sound an alarm or turn lights on... something like that anyhow.
Lots of resources:
trigBoard Docs: trigboard-docs...
The Ultimate Home Security Project is here: trigboard-docs...
Links to sample Gateway code and other things you see here: trigboard-docs...
I made a good tutorial on working with character strings: • Text String Tutorial i...
Tindie link to trigBoard: www.tindie.com...
Thanks to all the Patrons for dropping a few bucks in the tip jar to help make these videos happen!
/ kdarrah
Twitter: / kdcircuits
For inquiries or design services:
www.kdcircuits...
Everyone could benefit from having a long term project, passionately engaged! Good on ya' and congratulations!
thanks yea, took the week off from work and this is what I've been doin.. nice and relaxing
Thank you for the clear and concise instructions, it's easy for a novice to understand and very much appreciated.
I have worked with ESP-NOW. I combined it with 802.11LR and a cheap external antenna and I got at least 1500m (I couldn't test more) line of sight range and about 200m in an urban environment without a line of sight. You could easily halve "on" time even with ACK. The clunky part is addressing. You'll have to somehow set MAC address. But the good thing is that it's just incredibly fast. One of my gateways could handle 100 messages per second from 5 different devices. Just don't use the broadcast feature if you need the range because it doesn't retransmit missed packets.
were you encrypting?
Excellent
Well done
Cool stuff, Kevin! l.t.n.t. Hope things have been good for you. yeah i can see how versatile this could be. love keeping iot local. Keep up the awesome work! ~Bleu
Kevin I want to set up a little bugler system and this seems right to me.. But my problem is I am a 68 year old newbie.. I have a very little knowledge but this is still a little over my head.. mostly the nomenclature. Do you have a paper on this? I have saved this to watch again slowly later.. But a good paper on it would be nice.. also do you have other videos on your channel that would help?
yea, check out the description - there's links there to the docs page for this project. Also, you can start with a simple system first - see the QuickStart tab
Do you still do the original board with TH components please as I would like to make some?
If Iam not mistaken the minwifi lib is 64 conections... And for embebed is 256
Thank you for sharing.
Awesome project(s)!!
Any thoughts what would be involved in writing an ESP32 application, that takes data from the uart, and passes it wirelessly either via bluetooth** (SPP) or via Wifi?
For Wifi, I imagine the ESP32 could act as a web server (TCP) and display the RS232 data, but maybe there's also a UDP way to send data to a PC on the same network? I imagine, if the receiving application (mobile or PC) is written with the flutter framework, it could display the RS232 data with style!
**I purchase some USB-bluetooth dongles (Feasycom BP102, HC-05/HC-06/CP2102 master modules, etc).. but none can connect to any android phone! For example, when a Samsung S5 tries to connect to one of the bluetooth dongles, it will stop blinking, but after a couple seconds, Android says 'Can't communicate with the FSC_BP102' or HC-05, or HC06, etc.
Hey Kevin.
Please give me some keywords.
I have a Server setup with esp32 and a pc with rest end points and all, you know. Everything works wirelessly and all my devices are wifi controllable now.
Problem is, I need one esp for each board. Irrespective of how many pins I need. I have a feeling that one entire esp is a bit overkill for a board where one 1 or 2 devices are there.
Question: Do you think there are devices that can connect to my wifi and turn off or on a PIN? Little bit cheaper and more compact than a full fledged esp32
Use esp12e. They are much cheaper and use less power. Only 1 analog in. 16gpio. It's all I use.
Nice job!
which ESP32 releases the hounds?
this type of sketch will let 2 or more esp32 communicate in real-time?
Hi Kevin. This is a great improvement. I would like to build a LoRa trigboard...are you going to open source the trigboard datasheet of V8 as you did for the old version...that way I could do the LoRa version. Thank from France. Fred
maybe at some point - still pretty new
Very awesome! I have a greenhouse I want to monitor but esp won't reach without a relay (no electricity in the middle). Is there a way to use a battery powered esp broadcast repeater that won't use the battery up ? Like a way to wake and be low powered to broadcast back to my house? (My greenhouse has solar).
I do use ESP32's as WiFi repeaters - trigboard-docs.readthedocs.io/en/latest/cellularProject.html#repeaters-range-extenders But they would not last long on batteries - maybe you can place one at the very edge of your house?
Do you use Mosquito MQTT ?
Probably a dumb question but could the trig be used for a combination low power Bluetooth beacon/receiver and Pir sensor to help with location detection for home assistant?
Apparently it was a dumb question. Sorry about that I guess.
Why are you sending http data as a query string and not just normal data after the headers?
actually was just testing this today and works both ways, but almost think things go faster with the HTTP stuff... need to test more, but at least does not seem to slow things down
If you could analyse the spectrum could you then jam that spectrum and completely disrupt communication,
have you tried to play ‘devil’s advocate’ and break your own security system?
was thinking about doing a video on this - "Jam detection" and wouldn't be too hard to do - just have to setup cheap ESP32's around pinging back and forth with the gateway like some kind of heartbeat. If the connection with the beacons is ever lost, then you know something's not right.
Could you please share the code?
Oh man I'm struggling on how to program and set up my BLE BL651 from Laird connectivity. Is there anyway can you have a video how to get start on BL651 module?
see the description and reach out through my contact page
if you send messages from the server to the client randomly ?? if you send them by surprise will they able to get that ??
yea I was curious about this too, instead of polling... I think it's possible. I mean, could easily mix UDP with this TCP method, so Monitors are still UDP broadcasted to. That would allow the client connections be reserved for the high priority trigBoards
If we have to transfer large data, what is the through put from ESP32 to mobile
search for the ESPasync library - that's how I transfer files
Have you tried using ESP-NOW?
7:55
Where is the code for TCP?
links are in the description
I am very interested in espNow. I'm not really surprised there's no significant power difference between TCP and UDP ... it seems like a lot of the overhead would be wifi association. I like the use of an esp32 as a gateway. I have an esp32 with ethernet, have a desire to bridge espNow and ethernet. Using http server is unnecessary overhead - you could just listen on a port for a tcp connection and process it directly. Http protocol adds no value in this app.
hmm, yea I might try that out - I just started playing with this a couple days ago and started with example code from the ESPAsync lib
@@Kevindarrah yeah, a straight 'wait for connection on socket with a callback, read content from fd, write reply to fd, flush fd, close fd' kind of server and 'open connect to ip+port, write to fd, flush fd, read content from fd, close fd' client would do. Only complexity is the format of your content. You could use fprintf, fscanf if you want to stick to ascii, which the young kids are doing these days, or you could just send binary.
So I guess I contradicted myself - the only value http adds is the encoding of content as ascii or utf8, which you could achieve with fprintf/fscanf, or maybe json encoding. You're not sending much content though, so maybe fputs/fgets or write/read would suit you. Networking-wise, though, http doesn't give you anything but overhead.
thanks - gonna have to study up on that and try out - I'd like to eliminate as much overhead as possible
Any jamming detection?
nah, but that would be cool! Like maybe setup a beacon and if the gateway does not ever see that beacon, we know somethins up - idea for a video!!!
@@Kevindarrah that's exactly how I'd implement it. I suggest several at different extreme ends. If possible, dial back their radio power.
Really nice 👌 😍💋 💝💖❤️
Awesome 😍💋 💝💖♥️❤️