Debugging ESP8266 and Arduino Uno by printing to the Serial Monitor - arduino

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.

Related

HC-05 Bluetooth module help, can not recieive data

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.

Microchip Studio / STK500 Got 0xc0, expected 0x00

This project started as a typical hobbyist (me) learning how to replicate an Arduino Uno's basic functionality on a breadboard using an ATMEGA328P-PU. The basic intent of the circuit is to trigger 8 otherwise independent Halloween props using a single input, either cycling them continuously or upon command based on an input from a PIR sensor.
After validating the effectiveness of my design on a breadboard I had SMT PCBs professionally made which use ATMEGA328P-AUs (the SMT equivalent).The complete PCB schematic is provided below.
My PCB manufacturer informed me that they received an error when trying to upload my hex file using their STK500 connected to my on board ICSP header. Subsequently, they shipped my prototype PCBs with bare ATMEGA328P-AUs.
Upon receiving the PCBs I was able to use an Arduino Uno as ISP connected to my PCB's on board ICSP header to successfully load the Arduino bootloader, then successfully upload my Arduino program. I have repeated this process successfully multiple times and have subsequently been able to validate that the PCB logic behaves as intended in my application. My pin out on my PCBs ICSP header is identical to the ICSP header on an Arduino. It is 8 pins because I added TX and RX at the top.
I installed Microchip Studio and connected an STK500 via COM1. In Device Programming I selected device ATMEGA328P and Interface ISP. When I click "Read" I get the error depicted below. When I connect an Arduino Uno everything reads fine which leads me to believe that while my circuit contains the components required for a breadboard Arduino it is missing something that the STK500 needs to recognize it as a device.
After searching these forums and Google for similar problems the only two solutions that I can find are to use the internal clock (presumably on the ATMEGA328P?) and to "Disable Debugwire and Close" in Microchip Studio. All of the Debug functionality in Microchip Studio is greyed out for me and it isn't clear to me how I can change clock settings on a device that I can't communicate with. I did specifically incorporate an external clock to improve timing accuracy in my application, though, if that matters.
Any help or insight would be greatly appreciated.

Arduino - Sparkfun USB host

I am building a device and need to use a USB Nordic ID rfid reader. I have a Spark-fun USB host card (V9947), and now need the firmware to allow be bi directional chat in a 'rs232' style serial... just as if it were a hardware or software serial port on the Arduino.
Nordic support have reassured me that their library and examples for the Arduino are normally used with readers with RS232 ports, however the same code will work with their smaller USB device if I can overcome the USB/serial barrier.
I have the library and examples for the USB host board, but cannot determine which example code resembles my requirement requirement, I have looked through the library and found no answer there either.
This could be down to personal stupidity/ignorance... however never been this stumped before. the internet does not seem to have an answer, documentation and support for this board are at best meager.
I hope someone here has managed to solve what should be a simple mission, and I can get on with this project.
Thanks Ian
As not knowing what you already have done, I'll make a walk through the complete setup. Please check(do) each point evenif you think its done already:
Soldering and hardware have no shorts
pin headers of the shield are soldered with no shorts
USB Jack of Arduino is isolated on the top to prevent shorts
With the SparkFun board, it seems like you MUST supply external power on Vin or the barrel jack. 5V from the USB cable will not work reliable.
You must also run a jumper from pin D7 to RESET.
For the board (SparkFun DEV-09947) set up – these are mandatory pre-requirements.Now the software
The code/drivers you need to use for this board are on this GitHub page.
There is a diagnostic test which is extremely useful for checking wether your board is working correctly. Do as follows:
Upload this sketch to your Arduino, then open the Serial Monitor to see the diagnostic info.
To see the output set your Serial Monitor terminal speed to 115200
Plug in your hardware into the USB of the shield
Reset the Arduino to start the diagnostic
Step 1 – you’ll see it recognize the board and start a transfer test
Step 2 – you’ll see it attempt to test the GPIO pins – you’ll get “GPIO test failed” message. Type something in the box at the top of the Serial Monitor, then hit “Send” button and the diagnostic test will continue.
Step 3 – you should see it cycle through a bunch of resets, then it will attempt to detect an USB device – as we have a device plugged into the USB port on the shield you should then see some summary info with a final message of “All tests passed”
So NOW we know the hardware is working and basic software is running.
Next step driver installation/test program for the Nordic
Get the library from here
Import NurMicroApi_arduino.zip to IDE. From menu: Sketch->Include library->Add .ZIP library...
Open example. From menu: File->Examples->NurMicroApi->NurExample
Change baudrates and sw serial pins to match your arduino HW In this example NUR module is connected to arduino via software serial pin 10 (RX) and pin 11 (TX) with baudrate 38400. HW serial is used as print output.
You may have to change this to the USB card connections (see diag-SW)
As an easier option you can use the HID parser to check if your NUR is recognized If that works take a working exmple like:
Working HID example and try to read a tag then start coding with the NUR example from above if values are not correct interpreted
If you want to use the "pure" at-Terminal (RS-232) style you have to get rid of the usb shields functions (lib) and write your own Arduino firmware based (=overcome the USB/serial barrier) on the nordic-api (well documented) Hope this gets you started

PWM/PPM Output misses some edges

I am using ESP8266 (NODEMCU 3.0 or something) to make a quadcopter. Ive connected ardu pro mini to RC receiver so I am reading PPM values from it. Pro mini sends data with tx to ESP8266. ESP reads it with software serial with 115200 baudrate. I am communicating with MPU9255 (Waveshire) via I2C either.
My problem is that I cant fully controll my brushless motors. When I was using arduino instead of ESP8266, servo library was the best and reliable. But ESP's servo library is different, since its not AVR, and problems occurs. First of the servo library didnt want to work on most frequencies. I mean default is 50Hz (20000uS) and in this state ESC of motors did armed but unfortunatelly when changes was fast and short (1250-> 1370 -> 1250) it did miss that change like nothing happnd... This makes my D value in PID controller useless...
Sometimes on 100Hz freq all was working fine, but sometimes not...
When Ive started to use analogWrite only 500Hz was working fine, rest of freq didnt want to arm ESCs.
PS. I am using 3.3V to 5V converter for PPM/PWM pins so I am sure that the signal is fine for ESCs.
PS2. I dont have any osciloscope unfortunately.
The ESP82266 present on your module is a RF transceiver integrated circuit that can handle WiFi communication, both configured as a slave to a microcontroller such as the ones present on various Arduino boards, or as a standalone chip by having it's on-board Tensilica L106 32-bit processor programmed via an external SPI flash memory. If used as a slave, the communication between, for example, an Arduino an the ESP82266 can be done using different protocols such as SPI / SDIO or I2C / UART interfaces. Googling a comprehensive Tensilica L106 user guide on the internet doesn't seem an easy task, and it looks as if some people have already failed to find it. If you're seeking to add Wi-Fi capabilities to your quadcopter the solution I suggest is having the Arduino take control over the servos, motors, etc. and hand off messages via SPI to your ESP82266 module. If this isn't the answer you are looking for, please try to be clearer about it, maybe find someone to do as an English translator for you.
However, if this is what you're concerned about, and you would like to use the ESP82266 module as as standalone solution, please link its built-in processor datasheet and the relevant parts of the quadcopters code that might need debugging.

Arduino & ESP8266 - strange characters in response

I'm working on an Arduino Uno + ESP8266 project.
I try to use them as a web server on Wi-Fi network to control a motor that connects to Arduino - basically a trigger system that receives signals via Wi-Fi. Currently, I've successfully connected ESP8266 to my access point by sending AT commands from Arduino. Another client on the same network can statically access ESP8266's assigned IP address.
However, when I try to catch some HTTP queries (I want to use them as conditions to control the motor) I occasionally encountered the non-ASCII characters in HTTP request. I use serial comm to debug, please look at the screenshot in the link below:
Arduino - Computer serial communication for debugging
The line ",519:POST ..." should contain a complete number following "/?", but there's some strange characters instead. So I cannot determine the input data to control motor. Once in a blue moon, the expected format of request shows up as follows:
The correct data received
There's no issue with the HTTP response part, even though I got the uninterpretable request, I can still send the JSON error message back to client.
Attempt Note:
The Arduino uses different serial ports to talk to computer and ESP8266. Since the connection can be established, and the data being sent, I believe that the baud rate is simply correct on both side. (115200 for ESP8266, 9600 for computer - also tried 115200 for both and got the same result)
I use V3.3 from Arduino as power source for ESP8266. But I also use voltage regulator to smooth out the current as many people suggest that. The problem still remains.
I'm struggled with this issue for a few days, just want to know if anybody had the similar experience, or could give some clue for the next step.
After a considerable effort to stabilize the circuit, I switched to NodeMCU and got the system working perfectly. I assume that ESP8266 alone is somehow not robust enough without other components, which I unfortunately have no knowledge on.
So I'd like to close this thread with a short recommendation for anybody struggling with the same issue to switch to NodeMCU (which would replace both Arduino and ESP8266); if that could support the requirement.

Resources