I'm trying to run the esp32 cam using arduino uno and arduino IDE and my serial monitor is stuck in a loop.
I tried connecting my pins to:
"ESP 32"/"Arduino Uno"
UOR - RX 0
UOT - TX 1
GND - GND
5V - 5V
GND - GPI0 Res - GND
I'm expecting it to give me the ip address to the serial monitor so i can check if its working but it only shows me the loop here is the serial monitor message:
13:03:58.567 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
13:03:58.567 -> configsip: 0, SPIWP:0xee
13:03:58.567 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
13:03:58.567 -> mode:DIO, clock div:2
13:03:58.567 -> load:0x3fff0030,len:1344
13:03:58.567 -> load:0x40078000,len:13836
13:03:58.567 -> load:0x40080400,len:3608
13:03:58.567 -> entry 0x400805f0
13:03:59.541 ->
13:04:00.410 -> ........................
"the 13:03:58.567 is the time stamp"
I used the CameraWebServer Example code to get the ip address in the serial monitor.
i'm still new to this so i appreciate ay kind of help.
Related
Getting this error while uploading:
Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
Executable segment sizes:
IROM : 236720 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 26892 / 32768 - code in IRAM (ICACHE_RAM_ATTR, ISRs...)
DATA : 1252 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 780 ) / 81920 - constants (global, static) in RAM/HEAP
BSS : 24976 ) - zeroed variables (global, static) in RAM/HEAP
Sketch uses 265644 bytes (27%) of program storage space. Maximum is 958448 bytes.
Global variables use 27008 bytes (32%) of dynamic memory, leaving 54912 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.8
Serial port COM3
Connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last):
File "C:\Users\Arsh\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.7.4/tools/upload.py", line 65, in <module>
esptool.main(cmdline)
File "C:/Users/Arsh/Documents/ArduinoData/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 2890, in main
esp.connect(args.before)
File "C:/Users/Arsh/Documents/ArduinoData/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 483, in connect
raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
or it says Invalid Head of Packet(0xF0)
_
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
This is the pin configuration:
Insted of the 3.3v im using a voltage regulator.
Also RX connected to RX & TX to TX.
Code:
#include <ESP8266WiFi.h>
void setup()
{
Serial.begin(115200);
Serial.println();
WiFi.begin("username", "password");
Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Connected, IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {}
Someone suggested to ground the GPIO0, didn't work.
Tried installing different version of the Board:"Generic ESP8266 Module" still getting the same error.
The module works fine when working without the library using the Board:"arduino uno"
GPIO-00 needs to be held at ground while RESET goes to ground, then back to high. This reboots the ESP-01 into the FLASH mode.
For a good overview of a circuit to accomplish this, read:
https://www.allaboutcircuits.com/projects/flashing-the-ESP-01-firmware-to-SDK-v2.0.0-is-easier-now/
Read about the ESP8266 boot modes here:
https://tttapa.github.io/ESP8266/Chap04%20-%20Microcontroller.html
Could you give more details about the 3.3V regulator that you using?
Do you have it connected between the serial signals?
If that is the case, I suggest this connection instead:
3.3V signal voltage divisor
ESP TX and Arduino RX can be connected directly without any issue
I tried Octave Arduino Toolkit and tried following command.
>> pkg load arduino
>> arduinosetup
Running "C:\Program Files (x86)\Arduino\arduino.exe" "C:\Users\XXXXXX\AppData\Local\Temp\oct-aiBvJS\octave\octave.in
o"
ans = 1
>> dev = arduino
dev =
arduino object with fields of:
port = \\.\COM4
board = uno
libraries = {
i2c
spi
servo
shiftregister
}
availablepins = {
d0 - d13
a0 - a5
}
>> val = readVoltage(dev,"A0")
val = 1.9746
So i think it is working correctly. But i do not know
Q1. What is default buadrate of COM4
Q2. How can i change the baudrate
Does any body know the answer for Q1 and Q2?
=========
I found OCTAVE_COMMS_PORT.begin (9600) in LiberaryBase.cpp that seems to configure baudrate. So i changed 9600 to other value.
Compile and write successed but arduino octave does not work correctly.
The error message on Octave is
>> dev = arduino("COM4")
error: __initArduino__: failed valid response err=2 - Malformed packet header
error: called from
__initArduino__ at line 34 column 8
arduino at line 94 column 16
You set the baudrate for the Arduino uno to use in your code, generally the setup block.
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
There's many supported rates and other options (https://www.arduino.cc/en/Serial.Begin), but unlikely you'll need more than the above line.
This question is related to this, Cannot program ESP8266, but different settings.
I have a NodeMCU devkit v1, its comercial name is NodeMCU v2. I tried different setting to connect the devkit.
First the devkit has a usb-serial bridge (CP2102) and voltage adapter from 5v (USB) to 3.3v. So I connect the devkit with the machine via USB. The driver is installed correctly, and I can see the com, it is COM3.
After turning on the NodeMCU I can see a Wifi AI-THINKER-adfe21.
Then I tried with the nodemcu-flasher - WINDOWS.
Without any button or pin to ground. I press Flash in the flasher and stay Waiting MAC and the log says Begin Find ESP8266 as the question I told in the begin and the ESP's led (blue led) blinks.
Holding FLASH, press RESET, release FLASH. Still the same like 1.
Wire D3 (GPIO0) to GND. Same result
With ESPtool - LINUX - Trying these commands
python2 esptool.py --port /dev/ttyUSB0 read_mac
python2 esptool.py --port /dev/ttyUSB0 write_flash 0x00000 firmware.bin
Without any button or pin to ground. The output for the commands was Connecting... A fatal error occurred: Failed to connect to ESP8266
Holding FLASH, press RESET, release FLASH. Same
Wire D3 (GPIO0) to GND. Same result.
Via Arduino IDE, I installed the ESP8266 board and selected NodeMCU 1.0. The result to try upload some code -> warning: espcomm_sync failed error: espcomm_open failed
I tryed to connect the NodeMCU without the USB. Using an Arduino UNO, connecting like following... And I'm getting the same errors.
UNO | NodeMCU
5v -> Vin
GND -> GND
Rx -> Tx
Tx -> Rx
The last test I made, it is with Putty or Arduino SerialMonitor connect to the COM3 or /dev/ttyUSB0 and turning on the NodeMCU. I should see some characters or garbage if it in different baud rate. But I got nothing, the terminal is blank. I restart the NodeMCU, put it in Flash mode. No response.
Are there some solution, tip or trick to make it programmable?
PS: I know the NodeMCU is in Flash mode because its wifi disappear.
EDIT:
I discovered something.
I just connected the NodeMcu with a mobile charger and connect the D0 to Serial ground and D3 to Serial Rx. On the putty with 115200 Baudrate, I'm able to get the following code on reset.
node : sta(mac address) + softAP(mac address)
add if0
add if1
dhcp server start:(ip:192.168.4.1, mask:255.255.255.0,gw:192.168.4.1)
bcn 100
I have been working with both the node-mcu flasher and the esptool.
First in the esptool yo should use more parameter in the call. Use something like this
python esptool.py -p SERIAL_PORT_NAME --baud 9600 write_flash --flash_size=8m 0 firmware-combined.bin
Be careful with the baudrate, i always use 9600.
If you prefer using the windows program you should only connect the ESP8266 through usb and dont connect any other pin. If it still gives you problems you should check that u have installed the com ports.
Good Luck
if you are using esptool (either in Linux or windows), you should include -fm and -fs inside the esptool command. There will be no response if you did not include those 2 parameter even though it show successfully upload. you can refer the detail in this youtube tutorial or its description for flashing firmware in nodemcu V2 or v1.0.
esptool.py --port [serial-port-of-ESP8266] write_flash -fm [mode] -fs [size] 0x00000 [nodemcu-firmware].bin
Tutorial on how to flash firmware using esptool(windows):
https://www.youtube.com/watch?v=MHrm7axsImI
cheers!
Maybe you can try this setting.
$sudo esptool.py -p /dev/ttyUSB0 --baud 115200 write_flash -fs 16m -fm qio -ff 0x00000 firmware.bin
I have been trying to get my WiFi module, ESP8266 to work in the "update mode" where you connect GPIO_0 to ground.
The board is functional when GPIO_0 is disconnected from ground and I am able to use AT commands to talk to it via the Arduino serial monitor.
Following is what it prints upon connecting:
ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x40100000, len 1396, room 16
tail 4
chksum 0x89
load 0x3ffe8000, len 776, room 4
tail 4
chksum 0xe8
load 0x3ffe8308, len 540, room 4
tail 8
chksum 0xc0
csum 0xc0
2nd boot version : 1.4(b1)
SPI Speed : 40MHz
SPI Mode : DIO
SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 # 1000
rrlÌÿ
Ai-Thinker Technology Co.,Ltd.
ready
However, I cannot do most things as the firmware is out of date.
As a result, I am trying to update it (with no success)
When I set it to update mode and use the python tool "esptool.py", the script fails to connect to the ESP board.
Following is the command:
python esptool.py -p /dev/ttyUSB0 write_flash 0x00000 "/home/aditya/Desktop/v0.9.2.2 AT Firmware.bin"
Following is the output:
Connecting...
Traceback (most recent call last):
File "esptool.py", line 532, in <module>
esp.connect()
File "esptool.py", line 159, in connect
raise Exception('Failed to connect')
Exception: Failed to connect
I have even run the Windows counterpart of this tool "ESP Flasher" with no luck
The one who helps will be given a cookie (unless you value privacy)
This tool (esptool.py) works with a ROM bootloader, which is only started if GPIO_0 is tied to the GND during hardware reset. Bootloader also times out pretty fast, so just connecting GPIO_0 to the ground is not enough.
For me, following works:
Connect TXD/RXD/GND/VCC to the PC and CH_PD to VCC;
Make sure I can talk to the firmware via terminal (picocom/minicom/etc);
Connect GPIO_0 to the GND;
Connect RST to GND;
Release RST;
Run esptool.py
If still no dice, swap 5 and 6 above, i.e. first run esptool.py, then (as quickly as possible) release/disconnect RST. You will only have a second or two before esptool.py times out.
Try making the ground of all devices connected: if you have a level shifter inbetween, make sure the GND is tied to the GND of Arduino and also to the RS232 GND.
I'm doing a project involving uploading data wirelessly, from an analog sensor. In this case it is a light sensor.
I am using an Arduino Uno R2, and an official Arduino Wi-Fi Shield. Below is my code:
#include <SPI.h>
#include <WiFi.h>
#include <HttpClient.h>
#include <Xively.h>
char ssid[] = "Bradley's MacBook Pro"; // your network SSID (name)
int status = WL_IDLE_STATUS;
// Your Xively key to let you upload data
char xivelyKey[] = "SOP7lASYJVcRecV98zlHosDc9nLIAXqnDnIxRnXAmNeKorIk";
// Analog pin which we monitor (0 and 1 are used by the Ethernet shield)
int sensorPin = 2;
// Define the strings for our datastream IDs
char sensorId[] = "light";
XivelyDatastream datastreams[] = {
XivelyDatastream(sensorId, strlen(sensorId), DATASTREAM_FLOAT),
};
// Finally, wrap the datastreams into a feed
XivelyFeed feed(1125419529, datastreams, 1 /* number of datastreams */);
WiFiClient client;
XivelyClient xivelyclient(client);
void printWifiStatus() {
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your WiFi shield's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Starting single datastream upload to Xively...");
Serial.println();
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid);
// wait 10 seconds for connection:
delay(10000);
}
Serial.println("Connected to wifi");
printWifiStatus();
}
void loop() {
int sensorValue = analogRead(sensorPin);
datastreams[0].setFloat(sensorValue);
Serial.print("Read sensor value ");
Serial.println(datastreams[0].getFloat());
Serial.println("Uploading it to Xively");
int ret = xivelyclient.put(feed, xivelyKey);
Serial.print("xivelyclient.put returned ");
Serial.println(ret);
Serial.println();
delay(15000);
}
However unfortunately every time I get this back in serial:
Attempting to connect to SSID: Bradley's MacBook Pro
Connected to wifi
SSID: Bradley's MacBook Pro
IP Address: 10.0.2.3
signal strength (RSSI):-20 dBm
Read sensor value 1023.00
Uploading it to Xively
xivelyclient.put returned -1
Read sensor value 1023.00
Uploading it to Xively
xivelyclient.put returned -1
Read sensor value 684.00
Uploading it to Xively
xivelyclient.put returned -1
Read sensor value 684.00
Uploading it to Xively
xivelyclient.put returned -1
Read sensor value 684.00
Uploading it to Xively
No Socket available
xivelyclient.put returned -1
Read sensor value 684.00
Uploading it to Xively
No Socket available
xivelyclient.put returned -1
I noticed that after a few attempted it started to say No Socket available.
Does anyone have any clues as to where I've gone wrong?
I have resolved this problem. The issue is that I was using Arduino IDE 1.0.5 and there is a bug in that which prevents Wi-Fi communication. I have now changed to using an earlier IDE 1.0.2 and everything is running perfectly.
Even if you change IDE version to 1.0.2 , for few months it worked fine. If this problem occurs again, consider upgrading Wifi Shield Firmware . Latest package availble in Arduino site.It solved the error
Steps to follow for ugrading:
1. Download and install Flip from here. http://www.atmel.com/tools/FLIP.aspx You don't need to use or run the Flip program. There is a sub-program in the download you will need to use later. You will get to this sub-program (batchslip.exe) using a DOS command prompt. There is also a driver for the chip on the WiFi Shield (AT32UC3A or AT32UC3A DFU) that you will need.
If you recently installed a version of Arduino onto your computer, the software you need to update the WiFi Shield is in the Arduino directory structure. I know this to be true for me when I recently installed Arduino Version 1.0.5. (You might need to install a current version).
Connect your WiFI Shield to the Uno board. Put the jumper across both pins on 'DFU Programming Jumper'. Shown on 4th picture of the WiFi Shield on this page: ? http://arduino.cc/en/Main/ArduinoWiFiShield
To find the picture of the jumper, look for the words and arrow pointing to the board " DFU programming jumper (only used for updating shield firmware, leave unconnected for typical use)".
Connect power to your Arduino. Then connect a mini USB to the WiFi shield (not a micro-USB) and your computer.
Hopefully your Windows Device manager will show AT32UC3A DFU under "Other Devices". You may have to play with plugging/ unplugging power to Arduino and also the WiFI Shield's USB port connected to your computer. One time I had luck by not powering the Arduino and only plugging in the USB mini between computer and the WiFi Shield.
Right-Click on the device in 'Device Manager' and select "Update Driver" . I chose to install from my computer and directed the Device Installer application to Install from... C:\Program Files (x86)\Atmel\Flip 3.4.7 . I had an option to click "Include Subdirectories'. Sorry, I am not certain what sub-folder the driver might actually be in. When this step is complete, The AT32UC3A DFUshould be properly listed in Device Manager under "Atmel USB Devices".
Open a command prompt and navigate to the directory where "batchslip.exe" was installed by Flip. For me it was C:\Program Files (x86)\Atmel\Flip 3.4.7\bin ...but it depends where the Atmel software is installed and what version you download.
Once you are in the directory ( C:\Program Files (x86)\Atmel\Flip 3.4.7\bin) , you will need to run two commands. You will need to determine where you initially installed your Arduino software. I installed mine in C:\Arduino instead of the recommended lengthy folder suggested ( * something like C:\Arduino 1.0.5.) .. Therefore you might need to adjust the directory structure in the two commands I have listed below.
I suggest Cut and paste the first command from below, then make it match your * Arduino folder name. You may have to dump the following command in to a notepad or something to make sure there are no line breaks. Make the path as small as possible. Don't paste Arduino folder in program files while upgrading,because if path has Program Files (x86) ,spaces in between words will create un necessary error like : missing arguments
"
c:\Program Files (x86)\Atmel\Flip 3.4.7\bin>batchisp.exe -device AT32UC3A1256 -hardware usb -operation erase f memory flash blankcheck loadbuffer c:\Arduino\hardware\arduino\firmwares\wifishield\binary\wifi_dnld.elf program verify start reset 0
"
Here is what you should see on the command line..........
Running batchisp 1.2.5 on Sat May 10 21:16:01 2014
AT32UC3A1256 - USB - USB/DFU
Device selection....................... PASS
Hardware selection..................... PASS
Opening port........................... PASS
Reading Bootloader version............. PASS 1.0.2
Erasing................................ PASS
Selecting FLASH........................ PASS
Blank checking......................... PASS 0x00000 0x3ffff
Parsing ELF file....................... PASS c:\Arduino\hardware\arduino\firmwares\wifishield\binary\wifi_dnld.elf
WARNING: The user program and the bootloader overlap!
Programming memory..................... PASS 0x00000 0x2902b
Verifying memory....................... PASS 0x00000 0x2902b
Starting Application................... PASS RESET 0
Summary: Total 11 Passed 11 Failed 0
c:\Program Files (x86)\Atmel\Flip 3.4.7\bin>
Now to update the second piece
Cut and paste the command from below. You may have to dump it in to a notepad or something to make sure there are no line breaks.
"
c:\Program Files (x86)\Atmel\Flip 3.4.7\bin>batchisp.exe -device AT32UC3A1256 -hardware usb -operation erase f memory flash blankcheck loadbuffer c:\Arduino\hardware\arduino\firmwares\wifishield\binary\wifiHD.elf program verify start reset 0
"
Press Enter
Here is what will happen on your screen..
Running batchisp 1.2.5 on Sat May 10 21:34:04 2014
AT32UC3A1256 - USB - USB/DFU
Device selection....................... PASS
Hardware selection..................... PASS
Opening port........................... PASS
Reading Bootloader version............. PASS 1.0.2
Erasing................................ PASS
Selecting FLASH........................ PASS
Blank checking......................... PASS 0x00000 0x3ffff
Parsing ELF file....................... PASS c:\Arduino\hardware\arduino\firmwares\wifishield\binary\wifiHD.elf
WARNING: The user program and the bootloader overlap!
Programming memory..................... PASS 0x00000 0x3fe2b
Verifying memory....................... PASS 0x00000 0x3fe2b
Starting Application................... PASS RESET 0
Summary: Total 11 Passed 11 Failed 0
c:\Program Files (x86)\Atmel\Flip 3.4.7\bin>
Remove the Jumper from the WiFi Card. Remove the Min USB.
Verify Wifi shield with any sketch.
This method really solved the No Socket available issue.