I am writing some code for my arduino nano and I am using an HC-05 module for wireless transfer of data. I am sending my data as such. This is from the serial monitor, using a usb and regular print statements. I want to be able to recieve this data, and the store it in a csv (I know how to store incoming data). I need help recieveing my data.
22:17:46.765 -> =============================================================
22:17:47.770 -> Sleep timer:242
22:17:47.770 -> Light Sleep: 0 Deep Sleep: 0
22:17:47.805 -> Total Light Sleep: 0 Total Deep Sleep: 0
22:17:47.838 -> Total Sleep: 0
22:17:47.871 -> =============================================================
For some reason, when I connect my HC-05 to my windows desktop via bluetooth, and open a serial monitor in com ports 3 or 4, I get no read out.
My ports
I have it set up as so.
My wireless intialization
Then, I use
MySerial.print()
, to send data, yet I get no output, same thing occurs if I use
Serial.print()
.
I tried getting a new HC-05 module, Switched out all the hardware, tried different prints including Serial and MySerial. I though i could get an output.
Python code I tried to use python to extract the data, yet I get no output. I am not sure what to do here.
Not enough information, but I'll answer biased on the experience I've had with these modules.
Here are instructions for changing or verifying the baud rate on the module:
https://www.instructables.com/Change-the-Baud-Rate-of-HC-05-Bluetooth-Module-Usi/
For my module, I could just send AT commands by default without putting it into AT mode. Send 'AT' to the module and it should respond with "OK".
It helps a ton if you have an ftdi cable for troubleshooting. Connect the ftdi to the HC-05, verify the baud rate and that the HC-05 is responding, open a serial monitor for the bluetooth on the pc and one for the ftdi cable. Try sending data back and forth. Also, be 100% sure you're using the correct com port for your bluetooth by unpairing and repairing and see which com port shows up.
It actually is possible to use the HC-05 for programming the Arduino as well if you set the baud rate to 115200 and figure out a way to hit reset on the Arduino as soon as the bluetooth connects(status/state goes solid). I used an ATTiny for that, but you could just use a pin on the nano connected to reset and another pin to monitor the "state" pin which is connected to the led on the HC-05. That way you can have wireless data and wireless programming if you wanted that.
Related
I have a little project that includes connecting EPS8266 to the internet and send an API POST request from the data that is passed from my Arduino Uno. Until now, both module works perfectly fine separately (ESP8266 has succeeded connecting to WiFi and Arduino Uno can get the data from somewhere). Now the problem is how will Arduino Uno send the data to ESP8266 so that ESP8266 can make an API POST request as I mention above to send the data. I'm using UNO+WiFi R3 ATmega328P+ESP8266, 32Mb flash, USB-TTL CH340G, Micro-USB chip and by following this tutorial, I know that I have to enable dips number 1 and 2. But by doing so, I will not get the printout that I purposely tell it to (for debugging purpose). I have also watched an Indonesian YouTube video that shows me how to upload the code for both modules (but not for debugging purpose), but I noticed it has more actions than the tutorial gave me, I will just post the actions below:
Translations(I know it's self-explaining, but just in case): Koneksi = connection, Komunikasi = communication
From the image above, I saw that there is a way to debug EPS8266 and Arduino Uno's communication, which is enabling dips number 1, 2, 3, and 4. But when I tried it, the data was not sent, which makes me wondering if the trouble lies on the communication between EPS8266 and Arduino Uno, or enabled dips number is wrong for getting the printout. Is there any way of debugging whether my sent data has been received properly?(This is more important since I need to make sure that my data is the correct data) Or is there a way to just debugging whether the communication succeeds?
My code is really simple, just using Serial.write(something) on my Arduino Uno and Serial.get() on my EPS8266 and both written on my loop() method, not setup(). I also used 9600 baud rates on my Arduino Uno and 115200 baud rates on my ESP8266 (I of course have also tried changing the baud rates to check if there was a printout).
After uploading to your sketch to ESP8266 by switching ON dips 5,6 & 7
Just flip the dip number 7 to OFF.
Open your "Serial Monitor" in Arduino IDE,
Select the correct baud rate, then press the reset button on your Arduino.
You will be able to see your debug messages in your Arduino IDE "Serial Monitor".
Hope this helps.
I am trying to connect a WiFi module (ESP8266) to a "funduino" development board (Arduino Nano) but I have no success. Since I tried so much schematics I've found on the internet about the connection between them two, I kindly ask here if is anyone who succeed in "pairing" this two devices.
I am asking for the schematic and a functional source code.
Regards
The ESP-01 by default comes with nonOS SDK bootloader that communicated via AT commands, you can find the complete command set from Expressif here. This is designed for an MCU (like Arduino Nano) to use it purely as an WiFi module rather than using it as a stand-alone MCU (for which it will require NodeMCU SDK).
If you ever upload an Arduino sketch up to the ESP-01, it will erase the AT Command firmware.
Assuming your ESP-01 is still having the AT Command firmware. What #Ben provided is a sketch that allows you to type AT commands via the Serial Monitor to internact with the ESP-01, it is manual, and good for testing if ESP-01 is working (you type AT and press return on Serial Monitor, the ESP-01 will ack with Ok) but not practical as a real application. The minimum commands required to established an WiFi connection with ESP-01 is listed below.
AT+CIPMUX=1 - Enable single (0) or multiple connection (1) to the web server.
Multiple connection is a good option if you are repeatedly sending
out or reading data from the Internet.
AT+CWMODE=3 - Set WiFi mode: 1 is station mode (ESP8266 is client), 2 is AP mode
(ESP8266 acts like a WiFi router where your phone or PC can connect),
3 is AP+station mode (make the ESP8266 do both)
AT+CWJAP=“<your-ssid>”,”<your-pw>” - Connect to your WiFi. Provide your SSID name
and password inside the double qoutes.
AT+CIFSR - This returns the IP address of the module, indicating that it has
successfully connected to your WiFi router.
Once the WiFi connection is established, you can further communicate with the ESP-01 via the connection, like accessing a website for example:
AT+CIPSTART=0,"TCP", "www.example.com","80” - Start TCP or UDP connection. The
0 is the id of the connection.
AT+CIPSEND=0,16 - Command to tell the module data is ready to be sent. 0 is the
connection id, and 16 is the length of the data to be sent.
After this command, the ESP8266 will reply with the “>”
character to tell us that it will be waiting for the data to be
sent. If successful, the module will reply with “SEND OK”
GET / HTTP/1.1 - Send the http header, and other data, etc...
You can write your own sketch to automate those AT commands for interacting with with ESP-01 once you understand the AT commands required for establish a WiFi connection.
Here are two resources that I personally found extremely useful for doing more than connecting to WiFi.
STM32-ESP-01 Web Server - although this is for interfacing with STM32, the main difference is the pin assignment, so you should be able to port to Arduino easily.
MQTT via ESP-01
As for hardware interface, please noted that what #Ben provided is correct in principle, but you need to be aware that the ESP-01(ESP8266 to be precise) is a 3V3 MCU, so the connection is depended on what kind of host board you are using. If you are using Arduino Uno/Nano, both are having a 5V MCU, you will need a voltage divider (two resistors to drop the voltage to 3v3 before connecting to ESP-01) or a level shifter chip at least for the ESP-01 Rx pin to avoid the potential damage to the ESP-01.
I'm trying to write a simple code that sends a string to an xbee and one that sends the string back, I was able to do this with XCTU via console, but I want my arduino to send the string.
I was able to use a simple code that read my output from the serial monitor and sends it to an xbee connected via usb adapter, the problem is that I now wrote the code so it sends a predefined string like in the screenshot, but when I write into the monitor it still sends whatever I wrote instead of the static string. I'm also unable to read what I type into the xbee console from XCTU.
I'd love any assistance in this, I've tried uploading and resetting everything to no avail.
Screenshot of problem with the current code of the arduino on the left
You said you were using an Arduino to try to communicate with your XBee Zigbee module.
One thing you have to check is the connection between the TX and RX signals on the Arduino side and on the XBee Zigbee side.
I've helped someone on another forum who used this Seed Studio XBee shield :
If you look at the schematics of this shield, the XBee 'DOut' signal (Tx) is wired to the XB_TX line which can be connected to any of the AJ2 pin with a jumper.
Now on the Arduino side :
On this extract of the Arduino schematics, we can see that the ATMEGA UART has it's RX signal connected to pin 2 of the CPU which is wired to the IOL (AJ2) pin 0.
So, that means that on this shield, the jumper have to be placed between XB_TX and pin 0 of AJ2 to connect the XBee transmission signal (output) to the ATMEGA reception signal (input) [and also XB_RX have to be connected pin 1 of AJ2].
As you didn't mention what kind of shield you were using, you have to double check this point which is a common issue when using serial communication.
In a general way, ALWAYS connect 1 output to N input (except open-drain or open-collector outputs which can be connected together to make a wired OR but which finally have to be connected to N inputs)
Hope this helps
Best regards
From what I can tell on the documentation Xbee "hijacks" the serial system. Instead try blinking an LED to confirm data is being received and sent.
documentation
I am able to connect and upload the WifiStatus example per the instructions on the Arduino Site/Examples/Yun. However, when I hit the serial monitor button it is supposed to print out the relevant Wifi stats, instead it says "unable to connect" and the final line goes a bit further..."unable to connect: is the sketch using the bridge". Any ideas? A post suggested reseting the 32U4, which I did, but no luck.
Incidently, all of this is over Wifi. Board and port are set per instructions. Yun pings fine and receives the uploaded sketch fine.
More code is usually more illuminating... so you might get better answers when you provide more information.
"is the sketch using the bridge" seems to indicate that there is some problem with the Bridge library. Is it being initialized? Did initialization (i.e., "Bridge.begin()" succeed?
A sketch with bridge functional and serial monitor via network connection cannot be running simultaneously as they use the same hardware connection.
You may use the serial monitor via USB port, or Serial TX/RX pins, or SoftwareSerial for this.
I was using Arduino Uno to build a robot, but suddenly this error (stk500_getsync(): not in sync: resp=0x00) occurred. I tried a lot, searched on the net, to fix this error, but no solution worked for me. At last I bough 2 new Arduinos. But each of those 2 Arduinos ran few days correctly and after a few days gave the same error.
I was, and am, unable to find what causes this error. Can anyone kindly tell what could be the mistake I may be doing?
This has happened when the COM port is not correctly selected. Determine the COM port used to communicate with Arduino and set in in the IDE, then recompile the sketch.
I just found the reason from this link
of this error.
There are a TON of pages out there on how to solve this error. The problem is none of them worked for me. The typical solutions range from not having the correct serial port or correct Arduino model board selected under the Tools menu in the Arduino software, to not having a driver (or the correct driver) loaded.
However, the frustating part for me is I KNEW I had the correct serial port and board and driver selected because I was getting output from a sketch scrolling in the Serial Monitor window via a USB connection.
The fix? DISCONNECT ANY WIRES going to pin 0 (RX) while you do the upload. The sketch upload function uses the RX pin.
NOTE: You also need to disconnect any wires going to pin 0 (RX) if you have a sketch with a Serial.read() or Serial.peek() statement, and you want to use the Serial Monitor input field (as shown using the '752' in the example below) to feed data into the running sketch. If you don't disconnect pin 0 it will appear as if your data was entered into your sketch but nothing will happen because the data never truly gets input.
It's looks like there is no connection between PC and Arduino. Possible reasons: Something wrong with USB port OR driver, USB wire, ATMega16 controller, ATMega328 UART or bootloader. First, try to check, if data from Serial Port reaches Arduino. Pull ATMEGA from socket, short-circuit pins RX and TX on Arduino board (pins 0 and 1), and send some data from PC. You should receive exactly same string, as you sent. Also you should se RX TX LED's blinking. If you can't see data back, check if serial port you are using are actually exist in device manager, try to play with it's settings (speed, port numer), try to use another USB port and cable, etc.
I was having the same issue. But for me no led was lighting up on connection and the error observed was the same as yours. I fixed this by changing jumper pin configuration from ext to usb . You can try the same settings by altering the jumper pins between power jack and usb jack.