Tech Note 083 - ESP Sensor Server and Clients (for DHT, SHT, BMP085, BMP180, DS18B20, etc)

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ธ.ค. 2024

ความคิดเห็น • 130

  • @michaelpadovani9566
    @michaelpadovani9566 7 ปีที่แล้ว +3

    This is awesome, really like your channel and you have great talent at this. I'm working toward something like this in the near future...ie, multiple sensors broadcasting over wifi to a central server (esp32). Thank you for your efforts.

  • @deangreenhough3479
    @deangreenhough3479 6 ปีที่แล้ว

    Just what I was looking for, great work and well explained. Thank you for all your efforts in supporting newcomers.

  • @sanjayramasamy9102
    @sanjayramasamy9102 5 ปีที่แล้ว

    Brilliant, what a wonderful video, thank you very much for sharing.

  • @msmadaram
    @msmadaram 5 ปีที่แล้ว +1

    have you ever work on android broker such as moquette or something like that ?

  • @msmadaram
    @msmadaram 5 ปีที่แล้ว +1

    G6EJD have you ever work on moquette library broker for android?

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      Sorry no.

  • @johnbyrne1567
    @johnbyrne1567 6 ปีที่แล้ว

    Hi Seems to work both sensor and client connected, but only message in the browser is "hello from the ESP8266 Sensor Server" ?

  • @msmadaram
    @msmadaram 5 ปีที่แล้ว +1

    G6EJD how many esp12e client can connection to the esp12e server over tcp?

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว +1

      Officially 1, but in practice a client connects transfer and disconnects very quickly and I have tried 10 simultaneous connections which queue and have noticed no obvious delays

    • @msmadaram
      @msmadaram 5 ปีที่แล้ว

      @@G6EJD can i have your telegram ID or mail?

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      DOS via my website link on TH-cam

    • @msmadaram
      @msmadaram 5 ปีที่แล้ว

      @@G6EJD you mean a esp12-e in server mode can have 10 connection from 10 esp12-e client with TCP/IP?

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      DOS, the compiler has been designed to service only a single client, but in practice your client maybe another ESP will connect transfer its data and then immediately it is disconnected ready to enable another client to connect and so on, really there is no limit as clients won’t be able to connect if another already is. You will find each connection is taking mS to complete- try not to over think the problem.

  • @johnbyrne1567
    @johnbyrne1567 6 ปีที่แล้ว

    Sorry Dave me been stupid all working now thanks for the good work

  • @jontscott
    @jontscott 7 ปีที่แล้ว

    So once you have collected a bunch of data how do you go about searching or graphing (for example the data) I wonder if something like Grafana could pull data from the server? That is where I always get stuck. Is there an existing solution for collecting and displaying historical sensor data (without being on the public internet/cloud)?

    • @G6EJD
      @G6EJD  7 ปีที่แล้ว +3

      No existing data server that I have seen, which is why I embarked on this path. Today I have taken this code and added some more to make it look a little like Thingspeak, currently I can manage multiple sensors via the web front-end, next I will add time-stamps to the readings. I've added a date channel created field and date-time of last update. Next will be (already done but not tested) expanding the recording capability. I think it is going to be stored on SD Card as the only viable medium for the amount of data, SPIIFS is OK but limited. If I can find time I'll a graph of each channels data, so perhaps three or more small graphs to show the data records on a channel, e.g. temp, humi and pressure, so that would look like Thingspeak too. It takes me many hours to do all this, test, and then document the code, so a little limited in capacity, but getting there.

    • @jontscott
      @jontscott 7 ปีที่แล้ว

      This is very nice. I'm excited to see where it goes.

    • @_Chris_
      @_Chris_ 6 ปีที่แล้ว +1

      In my setup I use a influxdb database and a python script, which subscribes to the relevants MQTT topics and inserts data in the db (running on a SBC - Orange Pi 2 mini).

    • @G6EJD
      @G6EJD  6 ปีที่แล้ว +2

      There are many ways of achieving the data logging, each have their own merits. I'll publish a design in due course that does not require an interim server, but it will not use MQTT that's far too complex for a simple recording server IMO

    • @jontscott
      @jontscott 6 ปีที่แล้ว

      I have been playing with having an ESP8266 save data to a csv file on the SPIFFS and then from time to time I download the csv file and make a graph out of it in Excel... very manual and ugly. Also this is just a graph of my indoor/outdoor temperature currently (Hope to add power used by my electric heater some day) Anyway made me wonder if Grafana (or something like that) could pull the csv file and graph it automatically from time to time. (I only know of Grafana because at work my company uses Grafana so I see nice fancy dashboards there, but I have no experience with it beyond viewing pages other people collect data for and put together.)
      I like how the ESP can be the low power all ways on data collector, and then my laptop (or maybe a server) can do the heavy lifting of building graphs (and maybe someday trending power usage vs temperature just because I wonder...)
      I enjoy your videos that give new ideas about what it possible with the little ESP's, thank you :-)

  • @sangarmutusamy9801
    @sangarmutusamy9801 4 ปีที่แล้ว

    hi david, how to add bme680 data here? I mean if I want to show the air quality Good or Bad in text display?

    • @G6EJD
      @G6EJD  4 ปีที่แล้ว

      I’ve published a video on the Bme680 add those lines

    • @sangarmutusamy9801
      @sangarmutusamy9801 4 ปีที่แล้ว

      @@G6EJD Hi David, what i am trying to do is to combine Tech Note 083 (server) and Tech Note 067 (client) to display all the data from BME680 , its work but only 1 problem that it cant show the Air Quality result in text, i mean the Air Quality BAD, MODERATE, GOOD and so on. Can you pls help me? Thanks .

  • @hero-gl4zy
    @hero-gl4zy 3 ปีที่แล้ว

    Is there any limtation number of clients on this network?

    • @G6EJD
      @G6EJD  3 ปีที่แล้ว

      The maximum number of clients for both ESP types is 4

  • @VideoDetection
    @VideoDetection 7 ปีที่แล้ว

    Very impressive Dave! I would like to set up a temp/humidity sensor outside using a mini esp32 on a battery. Any thought of doing a tech note on a server polling a sensor using some form of wake up implementation to conserve battery.
    I really need to know how to conserve a remote sensor's battery for wifi use and use a wifi wake up to get the client to transmit data.

    • @G6EJD
      @G6EJD  7 ปีที่แล้ว +1

      I forgot to mention that in the client software all it needs is a sleep line adding and then the clients can sit asleep until ready to report, I’ll add a version to the code repository today. I have two an ESP32 and ESP8266 running like this and have been doing so for months. In fact they are identical to my ultra-low power trials that I did on previous videos. The ESP8266 out performs the ESP32 for power consumption in sleep, it uses more power when asleep but less when using WiFi and so wins as the WiFi element is the dominant power usage not sleep.

    • @G6EJD
      @G6EJD  7 ปีที่แล้ว

      I added the 'Sleeping' versions of the clients, so they sit asleep until the SleepTime interval times out then awakes, uploads, then go back to sleep. If you use a bare-board ESP8266 and 3.3v then it can run of 3 NiCad batteries (3.6v) for over a year easily, batteries would most likely self-discharge first though, so consider Eneloop types with low self-discharge.

    • @VideoDetection
      @VideoDetection 7 ปีที่แล้ว

      Thank you so much Dave! Your tech notes have really enabled me to get a handle of the use of esp32 and create successful projects.

  • @MrBobWareham
    @MrBobWareham 4 ปีที่แล้ว

    Hi Dave thank you for your channel and sharing your knowledge with us all I would love to make a door sensor with PIR for my front door and backdoor with battery power and one d1 mini to receive a message when one or the other detects a body any suggestions would be good thanks, Bob, in the UK

    • @G6EJD
      @G6EJD  4 ปีที่แล้ว

      Hi Bob, well buying ultra low power PIR sensors is fairly easy as they are freely available with adjustable sensitivity and on-time when detection occurs. The devices sit waiting for a trigger a d set a pin high when heat is detected, so your next challenge is what to do to send a signal to provide a message. Unfortunately there are few WiFi enabled controllers that can sit consuming low power waiting for a trigger, so your best choice is to use one of the very low power eg 433MHz transmitter ms again freely available which have an enable input, and it should be easy to link the PIR output pin to the RF Tx via its enable pin such that when the PIR triggers it enables a transmission. Next problem is you can’t differentiate between transmitters without some data to say which is which, that’s difficult to solve, but it gets you part way there. The ESP8266 would sit monitoring an RF 433 MHz receiver for a signal event. Alternatively you can place an ESP8266 into sleep mode and wake it via the PIR sensor pin then it sends a message, then goes back to sleep. Battery life would be about 6-12 months on an 18650 so not small, could be longer but I haven’t worked out the likely duration. Hope this helps.

    • @MrBobWareham
      @MrBobWareham 4 ปีที่แล้ว

      @@G6EJD Hi David thank you for your opinion and suggestion I think I will go with 433 Mhz as I can leave it powered off then power it on with a Mosfet triggered by the PIR so battery drain will only be to power the PIR I just need to work out coding on each TX and receive that on a two-channel 433mHZ receiver via an Arduino and some coding on the Arduino to wake up when data is received does that sound feasible? Bob

  • @Electromaniaworld
    @Electromaniaworld 7 ปีที่แล้ว

    thanks a lot... i have been trying to do exactly same... very helpful video

  • @awangbayunugroho522
    @awangbayunugroho522 5 ปีที่แล้ว

    awesome project

  • @achalasamapriya2701
    @achalasamapriya2701 4 ปีที่แล้ว

    can i send some thing back to the client like a set point from the server ??

    • @G6EJD
      @G6EJD  4 ปีที่แล้ว

      Yes you employ the same code as in the client it can be bidirectional

  • @NK-edu
    @NK-edu 5 ปีที่แล้ว +2

    Thank you! It is one of the greatest work on esp ever posted. Even if everything works fine, I have strange problem: the client works fine, the server receives data, and everything goes well for 1 or 2 minutes - after, that the server goes down, the connection is still there (ping ok), but the server is not reachable neither for pc nor for client. I am using two ESP32 DOIT DEVKITV1. This happens when sensor is presented and first information is already sent. Could you please suggest any kind of solution? I could provide log info and so on., but I think the problem is understandable. Thank you again!

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      Nikolay Kerenchev, it’s not s hardware issue, most likely you need to ensure the client is disconnecting after upload and there is enough time for the client to finish an upload and for the server to receive the data before the client disconnects. One thing to try is adding a small delay say 500mS before the client disconnects, this allows the server to respond and store the data. The next problem can be the storage medium as the SD card can be slow so maybe you have too much data on there from the clients. What update frequency are you using if the server is forever servicing clients then it won’t be able or have enough time to also service connection requests, this may be your problem. Also add some diagnostic print statements and monitor the serial port to see where it is bring held up. I have a server that has been ruining for 2-years non-stop and it’s works ok, no problems. My client update rate is every 10-mins.

    • @NK-edu
      @NK-edu 5 ปีที่แล้ว

      @@G6EJD Thank you for the reply! Trying to add delay befor and after the stop 2, 3 sec, same result. The server serial monitor shows:
      ets Jun 8 2016 00:22:57
      rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
      configsip: 0, SPIWP:0xee
      clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
      mode:DIO, clock div:1
      load:0x3fff0018,len:4
      load:0x3fff001c,len:928
      ho 0 tail 12 room 4
      load:0x40078000,len:9280
      load:0x40080400,len:5848
      entry 0x40080698
      Connecting ...
      Connected to Einstein Use IP address: 192.168.1.99
      Initializing SD card...Card initialised... data logging enabled...
      HTTP server started
      Waiting for time...Time set 21:53:23-09/04/2019
      /favicon.ico
      1 sensor, only. The sensor serial:
      ets Jun 8 2016 00:22:57
      rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
      configsip: 0, SPIWP:0xee
      clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
      mode:DIO, clock div:1
      load:0x3fff0018,len:4
      load:0x3fff001c,len:928
      ho 0 tail 12 room 4
      load:0x40078000,len:9280
      load:0x40080400,len:5848
      entry 0x40080698
      ...Connecting to Wi-Fi
      Wi-Fi connected
      IP address: 192.168.1.2
      ...Wi-Fi connected
      Locating devices... Found 0 devices.
      Parasite power is: OFF
      DONE
      ...Submitting Upload request
      ...Information to be uploaded: sensor?Sensor=1&temperature=0.00&humidity=0.00&pressure=0.00&spare=0.00&sensortype=DS18B20
      Attempting connection...connected
      DONE
      ...Submitting Upload request
      ...Information to be uploaded: sensor?Sensor=1&temperature=0.00&humidity=0.00&pressure=0.00&spare=0.00&sensortype=DS18B20
      Attempting connection...connected
      DONE
      ...Submitting Upload request
      ...Information to be uploaded: sensor?Sensor=1&temperature=0.00&humidity=0.00&pressure=0.00&spare=0.00&sensortype=DS18B20
      Attempting connection...connected
      DONE
      ...Submitting Upload request
      ...Information to be uploaded: sensor?Sensor=1&temperature=0.00&humidity=0.00&pressure=0.00&spare=0.00&sensortype=DS18B20
      Attempting connection... try again in 500 ms
      Attempting connection...
      Intresting the server goes unreachable under 192.168.1.99 after the first client connection. But the client still connects 3 4 times, and after that the surver doesn't respond at all, ping is still available. Time interval here is 30 sec, tried also 60, only 1 client and 1 sensor. Could be a SD card comunication problem, I am using Catalex adapter, but it worked fine with other sketches..

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      Nikolay Kerenchev, interesting, what is the time between client connections, it appears they are all sequential. If so this locks out the webserver as it responds to client connections all the time. I notice there is no ds18b20 reading and assume you are simulating the sensor. Is the server code unaltered?

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      Also it could be a browser issue you should try another to illuminate that possibility. Can you try s blank card?

    • @NK-edu
      @NK-edu 5 ปีที่แล้ว +1

      Dave, I tried fresh card and 3 browser on 2 comp. It seems that the client does not close the connection somewhere here:
      client.println("GET /"+UploadData+" HTTP/1.1

      ");
      client.println("Host: "+String(ServerHost));
      delay(1000);
      client.println("Connection: close");
      client.stop();
      The code is unchanged, only IPs and and the delay(1000) instead of 500. The DS18B20 is presented, but problably I have to play with the resistors, it gives values sometime, sumetime not, but this doesn't affect the client-server communication, the code deal with it., Thinking about how to force the client to stop the connection... and or... strange. Date/Time problem??. Mark: I am using the client code without the deep sleep implementation. I could try the other one. Thank you for the permanent help!

  • @sangarmutusamy9801
    @sangarmutusamy9801 5 ปีที่แล้ว

    Hi David, when i log in to the web, only message appear is "hello from the ESP8266 sensor server", what should do, pls help me.

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว +1

      Sangar Mutusamy, now it’s waiting for data from a client to be sent to it, you can simulate a client from another browser window using the example line in the code, as each new client is received it will be displayed

    • @sangarmutusamy9801
      @sangarmutusamy9801 5 ปีที่แล้ว

      @@G6EJD Hi David, thanks for your reply, the problem here is i dont see the home page all. my client and server are working fine when i monitor it serial port.

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว +1

      Sangar Mutusamy, have you tried a different browser like Firefox?

    • @sangarmutusamy9801
      @sangarmutusamy9801 5 ปีที่แล้ว

      @@G6EJD No i m not, the board that i used is esp32 devkit v1 type. The strange thing is client and server can communicate , only problem is no web page appear when i log in the ip address. The only message appear is " hello from esp" and its stay just like that. Or should i try with different board? Or do you think any problem with the ip add, gateway and subnet?

    • @sangarmutusamy9801
      @sangarmutusamy9801 5 ปีที่แล้ว +1

      Hi David, Beautiful...it's working now, it's my mistake not upload some of the library correctly, now everything is working fine. Thank you very much david this is very useful project.Really appreciate it. BTW i have 1 more question, is it possible to log the web page outside the wifi network? i mean from anywhere in the world? If yes pls guide me, as i love to learn this.

  • @AHmad-pm4pb
    @AHmad-pm4pb 5 ปีที่แล้ว

    Hi G6JD, My serial shows “Failed to obtain time”. Must I be connected to internet in order to fullfill this?
    Secondly i just bought a TP-Link router with ip address 192.168.0.1, Subnet mask 255.255.255.0, Default gateway 192.168.0.1, DNS server 0.0.0.0
    Its seems that the it just cant connect when I type 192.168.0.100 from web browser Chrome.
    Pls help. Thank you.

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      AHmad Albab, yes to get time you need an internet connection. Regarding the router connection, is the serial port reporting a successful connection and IP address? If so use that address but the address should be fixed by the code to be .100

  • @shashankshivhare3318
    @shashankshivhare3318 5 ปีที่แล้ว

    how to add PIR sensor string to the array you created in server code.??
    please help!!!

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      You can add a channel and the fields anything you like, maybe the range will be 0 to 1 so you know of the PIR is triggered or not then get the client to send to that channel the state either 0 or 1 or maybe when triggered.

    • @shashankshivhare3318
      @shashankshivhare3318 5 ปีที่แล้ว

      @@G6EJD if i add range 0/1 then how to convert that range into string within this array.
      sensor_record_type sensor_data[number_of_days][number_of_sensors * readings_per_sensor]
      if i simply convert float value1 to String value1 then it shows
      """"no matching function for call to 'String::String(String&, int)'
      """

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      shashank shivhare, you convert a float to string by doing this string status = string(variable name) where variable name is of type float

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      sensor_data[day_record_cnt][sensor_reading].value1 might be the variable name, or sensor_data[3][44].value1 for record 3 and reading 44

    • @shashankshivhare3318
      @shashankshivhare3318 5 ปีที่แล้ว

      @@G6EJD can i have your mail id or something to briefly explain you please!!!!

  • @dharanisharma6819
    @dharanisharma6819 5 ปีที่แล้ว

    Can I use it the other way to turn various relays connected to clients

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      See my video on using UDP to control clients.

    • @dharanisharma6819
      @dharanisharma6819 5 ปีที่แล้ว

      Thank you so much

  • @msmadaram
    @msmadaram 5 ปีที่แล้ว

    have you ever work on android broker such as moquette or something like that ?
    when we have one esp8266 and we want to connet to it with 20 mobile phone what happen?
    each esp8266 or esp 12e can just have 8 TCP/ UDP connection
    what's your idea if we have 20 mobile phones and simultaneous they want to connect to one esp publisher?
    if we run an android broker on one of mobile phones and other connect to it we can connect to esp by one TCP/UDP from broker to esp, is it true?
    have you ever work on android broker such as moquette or something like that ?

  • @sangarmutusamy9801
    @sangarmutusamy9801 5 ปีที่แล้ว

    Wifi connected now but i cant see the web pages, pls help.

  • @dasdunetechnologies1695
    @dasdunetechnologies1695 5 ปีที่แล้ว

    Nice, but instead of using multiple queries use a json file approach using the body part of your request, another improvement maybe use web sockets instead of http requests

  • @glynnmason8205
    @glynnmason8205 6 ปีที่แล้ว

    this could be usefull will give it a go

  • @omarsmith9674
    @omarsmith9674 4 ปีที่แล้ว

    sir i dont understand about your .ino code, can you give some explanation about it?

    • @G6EJD
      @G6EJD  4 ปีที่แล้ว

      Which part?

  • @shathyaduobiene4626
    @shathyaduobiene4626 5 ปีที่แล้ว

    Hi awesome video, I have a question when I try to run this server program it shows "server IP address could not be found" But IP address is same which I tried. can you help me

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      Shathya Arumugam Kodeeswaran, do you monitor the serial port for the IP address then connect like this 192.168.0.99 or whatever your address is, if you want to use a logical name like sensorserver instead of an IP address then you need to install Apples Bonjour application that resolves a logical name to a physical address.

    • @shathyaduobiene4626
      @shathyaduobiene4626 5 ปีที่แล้ว

      @@G6EJD Thank you. Right now working fine. In serial monitor I can see everything happening correctly. web browser is out of reach. 192.168.8.99/sensor?Sensor=1&temperature=22.10&humidity=39.00&pressure=0.00&spare=0.00&sensortype=DHT11-1
      the link shows the below "The site cant be reached"
      Serial montior showing all the readings correctly. How I can view the same result in 192.168.8.99/ in the browser

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      Ok, you need at least 2 devices, one is your client and it looks like that’s running correctly, next is a server, which in your example is the IP address you’ve assigned it, make sure the IP address for the server is the same as the client is sending to. Also make sure it’s on the same network, so for example your PC or phone IP address may be 192.168.8.25 so you have to use for example 192.168.8.100 or some spare address. It’s unusual to have .8. Addressing are you sure, check what address your pc is at. When correct enter in your browser the address of the server and it will display the home page. If you make the client updates too fast the server never responds to a connection request, so make sure your client update rate is in minutes of interval, say 10 minutes. Please let me know how you get on.

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว +1

      I may be misunderstanding what your trying to do, you can’t easily see what’s been sent with your browser but the server can read the transmission and print it out.

    • @shathyaduobiene4626
      @shathyaduobiene4626 5 ปีที่แล้ว

      @@G6EJD exactly. In browser I'm seeing waiting for sensors. When clients connected browser showing unable to reach the IP. In serial monitor I can see the transmission client sending and server reaching each 1min. I will try to increase the time to 10min. Thank you Dave.

  • @msmadaram
    @msmadaram 5 ปีที่แล้ว

    have you ever work on android broker such as moquette or something like that ?
    when we have one esp8266 and we want to connet to it with 20 mobile phone what happen?
    each esp8266 or esp 12e can just have 8 TCP/ UDP connection
    what's your idea if we have 20 mobile phones and simultaneous they want to connect to one esp publisher?
    if we run an android broker on one of mobile phones and other connect to it we can connect to esp by one TCP/UDP from broker to esp, is it true?
    have you ever work on android broker such as moquette or something like that ?
    and we don't have cloud on the net!!!

  • @sickvic3909
    @sickvic3909 7 ปีที่แล้ว

    Cool, so this is our own server not tied to any other company?

    • @G6EJD
      @G6EJD  7 ปีที่แล้ว +1

      Correct

    • @G6EJD
      @G6EJD  7 ปีที่แล้ว +1

      I’ll think about your idea as it would be good to not use e.g. Thingspeak to store reading values, ultimate storage using flash would be limited to 3MBytes but using an SD Card would seriously extend storage now that 512GB cards are reaching the market. Even 32GB would be huge storage.

    • @sickvic3909
      @sickvic3909 7 ปีที่แล้ว

      That to, but I was thinking was saving 2 or more on board uploaded code to uno etc. and switching from one to the other, guessing not. When I finally get something working it takes way less time to loose it all.

  • @sangarmutusamy9801
    @sangarmutusamy9801 5 ปีที่แล้ว

    Hi David, my wifi is not connected, pls help

  • @0805bryan
    @0805bryan 5 ปีที่แล้ว

    How to send more than 20 bytes in each connection

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      Bryan Chen, you can send as much as you like! Just send you data in place of a sensor reading.

    • @0805bryan
      @0805bryan 5 ปีที่แล้ว

      @@G6EJD Hi ~I used ESP32 client source code how to spilt [newValue]string to send >>>// If we are connected to a peer BLE Server, update the characteristic each time we are reached
      // with the current time since boot.
      if (connected) {
      String newValue = (",1234567890qwertyuioopp");
      Serial.println("Setting new characteristic value to \"" + newValue + "\"");
      // Set the characteristic's value to be the array of bytes that is actually a string.
      pRemoteCharacteristic->writeValue(newValue.c_str(), newValue.length());

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว +1

      Bryan Chen, code looks ok, what’s wrong with it?

    • @0805bryan
      @0805bryan 5 ปีที่แล้ว

      @@G6EJD i think i need to spilt strings into few pocket to send >>> www.silabs.com/content/usergenerated/asi/cloud/attachments/siliconlabs/en/community/wireless/bluetooth/forum/jcr:content/content/primary/qna/how_to_send_moretha-7iCg/hi_no_you_don_t_n-ajmi/ble_send_function.c

    • @0805bryan
      @0805bryan 5 ปีที่แล้ว

      @@G6EJD I think I found problem. I use two ESP32 ,one is to be client another one is uart to see received data. I found all data have received.
      So there is no problem . I have a ble door lock , the data send must pocket every 16bytes , So if esp32 does not follow the rule , the door lock does not opened. If you know how to spilt strings please kindly let me know how to do. thank you...

  • @haroon552
    @haroon552 5 ปีที่แล้ว

    Thanks for providing beautiful project, server stuck after receiving data from client, i am using nodemcu esp8266 for sever and client both, client sketch bme280 sleeping, and Advanced Server for server, could you please guide me to resolve the issue?

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      What update speed are you using, the ESP8266 can’t run that fast, for example about every 5-mins minimum if you set your client to update too quickly the server can’t keep up.

    • @haroon552
      @haroon552 5 ปีที่แล้ว

      @@G6EJD 1 minute update. the only problem comes with the sketches that are having deep sleep in the client. I removed the deep sleep functionality in the client it works. and one more thing I tried to use ESP32 for the server that stuck when it receives data from any client with or without sleep.

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      You need to ensure you are using the latest ESP IDE extensions so 2.5.2 for the ESP8266 and 1.0.2 for the ESP32. Also add a 500mS delay on your clients before allowing sleep maybe up to 800mS ( delay(800); ) so that the http transfer between client and server can complete, this is a function of network performance.

    • @G6EJD
      @G6EJD  5 ปีที่แล้ว

      I’ve just checked the source code for the clients they all have a 500mS delay after the client.print statements that may need to be longer 800-1000 mS. You can simulate a client from a web browser command line example in the source code.

    • @haroon552
      @haroon552 5 ปีที่แล้ว

      @@G6EJD Thanks for the reply, I will check n reply you status.