Author Topic: ESP32 Data Transfer  (Read 2735 times)

0 Members and 1 Guest are viewing this topic.

Offline Sparky49Topic starter

  • Regular Contributor
  • *
  • Posts: 92
ESP32 Data Transfer
« on: October 02, 2018, 04:23:33 pm »
Hi,

I've been doing some very simple experiments with an ESP32 module running an Arduino core recently, as part of a project where I'd like to control the duty cycle of two PWM lines from an android app through a wifi connection. I have some basic skills in C, but very little experience in interfacing with existing code/protocols etc - mostly I've just been writing simple embedded stuff.

Whilst I've managed to get the ESP to toggle a GPIO on or off by changing the url through a browser, or by clicking a hyperlink on a server created on the ESP using example code, I don't think that this would be ideal for controlling two separate duty cycles, as you'd need to have a whole host of urls to send data. Is there a more efficient way of sending data to my ESP32 via wifi? I envisage that it would likely take the format of a string, say "A32" for pwm channel A at 32%.

I have seen services like Blynk, but would prefer to stay away from such things as they seem to make it too easy - I want to learn about the processes involved, but my inexperience in this field has it seem a bit daunting. Any further advice regarding how to learn how to understand these processes would be appreciated too.

Thanks in advance.
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: ESP32 Data Transfer
« Reply #1 on: October 02, 2018, 05:00:20 pm »
Can't use url parameters? Like this:  http://device/pwm?dutycycle=45
The further a society drifts from truth, the more it will hate those who speak it.
 
The following users thanked this post: Sparky49

Offline Sparky49Topic starter

  • Regular Contributor
  • *
  • Posts: 92
Re: ESP32 Data Transfer
« Reply #2 on: October 02, 2018, 05:02:22 pm »
That seems so obvious now you mention it.  :-DD

Perhaps that would be best for me to use until I get more familiar with the systems in play. Thanks George, much appreciated.
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: ESP32 Data Transfer
« Reply #3 on: October 02, 2018, 05:19:40 pm »
You're welcome!
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline JustMeHere

  • Frequent Contributor
  • **
  • Posts: 919
  • Country: us
Re: ESP32 Data Transfer
« Reply #4 on: October 05, 2018, 12:43:07 am »
You want to use a REST style api.  The example above is a start.
 
The following users thanked this post: Sparky49

Offline rjp

  • Regular Contributor
  • *
  • Posts: 124
  • Country: au
Re: ESP32 Data Transfer
« Reply #5 on: October 05, 2018, 12:53:29 am »
their are 3 main options.

custom udp or tcp - open a raw socket straight to a custom daemon on some server type machine.
this one is good for learning but also means you need recreate alot of wheels.

http - usually REST,  easy to do,  relatively slow and resource heavy

mqtt - very lightweight and has some nice features like distributed events, eg: you can extend it to other lights without changing the main code.
potentially makes things more complicated with maintaining multiple daemons, if you dont like that sort of thing.

 
The following users thanked this post: Sparky49

Offline Sparky49Topic starter

  • Regular Contributor
  • *
  • Posts: 92
Re: ESP32 Data Transfer
« Reply #6 on: October 05, 2018, 05:24:43 pm »
Thanks JustMeHere and rjp, alot of terminology I have never come across but will have fun reading up on!

Fwiw I managed to get the method mentioned by George implemented, and just finishing off by fiddling around with some interrupts now. :) I will definitely have a look at the other methods mentioned though.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->