View previous topic :: View next topic |
Author |
Message |
MarkchchPIC
Joined: 14 Jan 2015 Posts: 18 Location: Christchurch New Zealand
|
Testing my thinking |
Posted: Wed Sep 13, 2017 10:46 pm |
|
|
Hi All,
I wish to test my thinking on a project before I hit the computer to create code.
I have an 18F46k20 running at 3.3v and I wish to experiment with an ESP01 module which also runs at 3.3v.
My question relates to using the UART of the PIC to talk to the ESP01 with AT Commands.
If I understand correctly I would cross connect the two devices i.e PIC TX to ESP RX and PIC RX to ESP TX. Then using a baud rate of 115200 I should be able to talk to the ESP01 module sending strings from the PIC.
Have I understood correctly?
Cheers
Mark |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19557
|
|
Posted: Thu Sep 14, 2017 1:21 am |
|
|
Yes.
Several comments:
1) Make sure the module you get has the later V2 firmware. It is possible to upgrade the module, but is a complexity you don't want to get involved in at this point.
2) The CH_PD pin will also need to be taken to 3.3v, so there are five connections needed. GND, 3.3v power, TX, RX, and this pin. Some boards have a jumper on the board to pull this pin to Vcc. If so you can use this.
3) RST should be pulled high on the module, but adding a 10KR resistor to pull this high is safer.
4) Old comment, make sure you add a nice capacitor on your supply where it connects to the module. It can tend to inject RF back into the supply rail otherwise...
5) Be careful if you want to use GPIO0 or 2. GPIO0 in particular must float at boot for normal operation. Pulling this low can trigger the firmware bootloader.
They are a nice module, and easy to use. Take your time and make sure you are understanding what you intend to send before talking to it. You don't want to accidentally re-configure it to the wrong baud etc..
Remember carriage return.
printf("AT\r");
is what is needed to get the initial "OK" response.
Also give is some time to wake up before starting to talk to it. The ESP takes a minimum of 0.2 seconds to start. |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Thu Sep 14, 2017 1:55 pm |
|
|
Hi,
Just out of curiosity, what do you plan to do with the ESP01 module? I ask because I started out a few years ago using the PIC with the ESP series via the UART, but then realized that I could do everything with just the ESP alone (it has a built in micro!). These modules are easy to work with using the Arduino IDE and a simple USB-to-serial programming cable. I designed a suite of IoT wireless sensors this way, and they've been working flawlessly for 2 years! As much as I love PIC's and CCS 'C', it just wasn't needed for my applications! _________________ John
If it's worth doing, it's worth doing in real hardware! |
|
|
MarkchchPIC
Joined: 14 Jan 2015 Posts: 18 Location: Christchurch New Zealand
|
Thanks |
Posted: Thu Sep 14, 2017 2:17 pm |
|
|
Thanks to you both.
Ttelmah, great advice to get me started.
ezflyr, I realise I could do more directly using the modules like the wemosD1.
I have a lot of other code and hardware already setup for PIC and would like to use the ESP01 to get me on the net.
Cheers
Mark |
|
|
|