Forum Replies Created
-
AuthorPosts
-
Sara,
Thank you so much for your reply. I was just getting ready to try to figure it out. I’ve been having issues with my batteries draining, so this will be a tremendous help.Edited 6/8/19:
After some trial and error, you need to set pin 23 to LOW before transmitting. At least that’s what I could get to work with the xBee’s I’m using.
digitalWrite(23, LOW); wake up the xBee
Serial1.print(“some text);
// more print statements as desired
digitalWrite(23, HIGH); put the xBee to sleepThe end nodes are set to pin-sleep mode so that the Mayfly wakes them when it’s time to send data. So the Mayfly just drives a pin low (Xbee modules sleep when pin high, and wake when pin low) to wake the module, send it a line of serial text at 9600bd, and the Xbee transmits that line to the coordinator (who’s always awake), and then the Mayfly puts the Xbee back to sleep
Shannon,
Would you be willing to share the code that drives the Xbee pin to low (or high)?Thank you
SOLUTION:
I changed the default baud rate on the ESP8266 from 115200 to 9600 and things started working. The AT command I used was AT+UART_DEF=9600,8,1,0,0
Here is where I found this command:
https://arduino.stackexchange.com/questions/24156/how-to-change-baudrate-of-esp8266-12e-permanentlyJust curious why the ESP8266 wasn’t working at 115200? Does the Mayfly not support this baud rate?
My error was indeed in how I downloaded the files. Shannon, thank you for setting me straight. Daniel, thank you for the image.
Sara, thank you for your response. I’m glad to hear it is possible. Here’s what I’ve got thus far.
Mayfly <—-> ESP8266 ESP-01
Rx1 <——-> Tx
Tx1 <——-> Rx
Gnd <——-> Gnd
Sw3 <——-> VCC & CH_PD12345678910111213141516171819202122232425262728293031323334353637383940414243444546// https://allaboutee.com/2014/12/27/esp8266-arduino-code-and-circuit/void setup(){Serial.begin(9600);Serial1.begin(115200); // your esp's baud rate might be differentpinMode(22, OUTPUT); // TURN SW_3 TO 3.3V https://www.envirodiy.org/topic/hcsr04-sw5/digitalWrite(22, HIGH); // TURN SW_3 TO 3.3V https://www.envirodiy.org/topic/hcsr04-sw5///Serial.print("Here we go...");}void loop(){//Serial.println("hello");if(Serial1.available()) // check if the esp is sending a message{while(Serial1.available()){// The esp has data so display its output to the serial windowchar c = Serial1.read(); // read the next character.Serial.write(c);}}if(Serial.available()){// the following delay is required because otherwise the arduino will read the first letter of the command but not the rest// In other words without the delay if you use AT+RST, for example, the Arduino will read the letter A send it, then read the rest and send it// but we want to send everything at the same time.//Serial.println("Serial.available");delay(1000);String command="";while(Serial.available()) // read the command character by character{// read one charactercommand+=(char)Serial.read();}Serial.print("Command sent to ESP= ");Serial.println(command);Serial1.println(command); // send the read character to the esp8266}}I attached a screenshot of the Serial Monitor with the results I get back from the ESP when I send AT commands to it. Do I have a baud rate issue?
To test if the ESP was working, I connected it to an Arduino UNO via an Aideepen Adapter Module. The ESP worked and the responses were as they should be.
I’ll continue to play around with my setup and see if I can figure it out. Any insight would be greatly appreciated.
Update:
The second image attached is the Serial Monitor when I changed the code to Serial1.begin(74880);Attachments:
This is my first time to use Eagle. I downloaded the free version (maybe this is the issue) in an effort to view the protoshield dimensions. When I try to open the .brd file, I get the following error:
line 8, column 16: This is not an EAGLE file.
I would appreciate your insight as to what I’m doing wrong.
I’d also like to transfer data received from the xBee and transmit it to the internet. In my situation, ethernet is not an option. I need to go from the xBee to WiFi. Can I attach an xBee and an ESP8266 to the Mayfly? Or is there a better method?
I’ve been using the Mayfly for two years to log soil moisture levels and record it on the SD. It’s been a great board! Looking forward to getting this setup to transmit to my database. This year, I’ll have roughly 15 Mayfly’s reporting back moisture levels.
Thank you,
Jon -
AuthorPosts