so I got my Arduino Uno today. For a porject I want to be able to control some relays on my Arduino via Wifi (via Blynk app). For this I want to use the ESP8266-01 as a Wifi shield.
I used this tutorial: https://create.arduino.cc/projecthub/nolan-mathews/connect-to-blynk-using-esp8266-as-arduino-uno-wifi-shield-m1-46a453
Only difference is I'm using Win10. Here is what I got:
Arduino Uno R3
Arduino IDE 1.8.1
included all Blynk/ESP libraries and installed ESP8266 as board (generic)
uploaded empty sketch to the Arduino
Connections to Between Arduino/ESP as follows . http://www.teomaragakis.com/hardware/electronics/how-to-connect-an-esp8266-to-an-arduino-uno/ (I know about to 3.3V to 5V issue but seems to work so far)
Okay, first problem is that I couldnt flash the Firmware of the ESP (got it from Sunfounder) as said in the Tutorial. Downloaded the latest firmware and flashed it with ESP8266Flasher.
Other Problem that is when I try to compile the code from the first tutorial, I always get error :
C:\Users\Chris\Documents\Arduino\libraries\Blynk\examples\Boards_WiFi\ESP8266_Shield\ESP8266_Shield.ino:5:21: fatal error: ESP8266.h: No such file or directory
As said I have installed all libraries. Cant really think of things to do anymore. Any help would be much appreciated. Best regards from Berlin, Chris.
To close the code I try to upload to the board (both Arduino Board or generic ESP8266 does not work)
//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266.h>
#include <BlynkSimpleShieldEsp8266.h>
// Set ESP8266 Serial object
#define EspSerial Serial
ESP8266 wifi(EspSerial);
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "???";
void setup()
{
Serial.begin(115200); // Set console baud rate
delay(10);
EspSerial.begin(115200); // Set ESP8266 baud rate
delay(10);
Blynk.begin(auth, wifi, "???",
"???");
}
void loop()
{
Blynk.run();
}
The ??? I switched for my token and data ofc.
Try changing this
#include <ESP8266.h>
to this
#include <ESP8266_Lib.h>
The file was renamed in this commit.
Related
I am trying building a project that requires me to use 6 UART connections. For this I have chosen the STM32F030CCT6 MCU, which supports 6 USARTs. I have gotten all 6 to work in the STM CubeIDE, but have decided to switch over to the Arduino IDE because I would like to use a few libraries.
In Arduino, I am using the latest Arduino_Core_STM32 api.
The api doesnt specify the suport for this exact chip, but it lists supports the STM32F030C8T6 chip, which for all intents is the same, with the only difference that it supports only 3 USARTS. I have tried using both HardwareSerial and SoftwareSerial libraries to add uarts, but when I add more then 2 UARTS the code compiles, uploads and executes until the first UART and then just "hangs" until I reset the chip.
My question is if I can somehow modify the library/get a different library that supports all 6 USARTS of this chip.
Alternativly, is it possible to use the working code generated in MXCube in Arduino and use the USART that way?
Or is this just a problem with Arduino_Core_STM32?
used settings to program
code:
#include <EthernetENC.h>
#include <HardwareSerial.h>
#include <SoftwareSerial.h>
HardwareSerial mySerial1(PA5,PA4); // compiles, can also use (USART1)
HardwareSerial mySerial2(PB11,PB10); // compiles, can also use (USART2)
HardwareSerial mySerial3(PA10,PA9); // compiles
void setup() {
pinMode(PB15, OUTPUT); //CP WRITE 34
digitalWrite(PB15, LOW);
}
void loop() {
digitalWrite(PB15, HIGH);
delay(500);
digitalWrite(PB15, LOW);
delay(500);
mySerial1.begin(9600);
mySerial1.println("Hello, world?");
mySerial1.end();
mySerial2.begin(9600);
mySerial2.println("Hello, world2?");
mySerial2.end();
mySerial3.begin(9600);
mySerial3.println("Hello, world3?");
mySerial3.end();
}
Thank you to everyone for the insight, learned a lot of new things.
I managed to get all 6 USARTS to work by creating a new board variant.
The port map files were already present for this board (and many others )in the
AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.3.0\variants folder.
I just edited the boards.txt file to add the F030CCT folder and created a .ld file in MX cube and added it to the folder. The board now behaves like it should and all the pins and functions work great.
I just changed the top part of the code to:
HardwareSerial SerialX(USART1);
HardwareSerial SerialY(USART2);
HardwareSerial Serialz(USART3);
HardwareSerial SerialX2(USART4);
HardwareSerial SerialY2(USART5);
HardwareSerial Serialz2(USART6);
I am working in ArduinoIDE with ESP32 and TFP625A fingerprint sensor. The sensor is connected to UART2 and served by the FPM library using HardwareSerial. Everything works fine until a programmatically reboot is performed - ESP.restart(). After this command, the microcontroller reboots and stucks at the place of sensor initialization. I inserted some Serial.print() into the HardwareSerial source code file and saw that in the HardwareSerial::begin() function, the code does not go further than this place
_uart = uartBegin(_uart_nr, baud ? baud : 9600, config, rxPin, txPin, 256, invert);
As I understand it, after rebooting the microcontroller, information about the previously configured UART2 remains in its registers. Attempts to zero the UART before rebooting the microcontroller do not correct the situation. If I make hardware restart the microcontroller by the reset button, then everything works fine.
How to overcome ESP32 stuck?
Snippets of code:
#include <HardwareSerial.h>
#include <FPM.h>
HardwareSerial mySerial(2);
FPM fpm(&mySerial);
...
void freeFPM()
{
fpm = 0;
mySerial.end();
mySerial = 0;
}
bool fpm_setup()
{
freeFPM();
mySerial = HardwareSerial(2);
finger = FPM(&mySerial);
mySerial.begin(57600);
fpm.begin(0);
}
void restartESP()
{
freeFPM();
ESP.restart();
}
I think you need to include a hard reset of the sensor when the ESP32 restarts. I am not familiar with that particular sensor but I've had similar issues.
What I did was to wire the reset input of the sensor to a GPIO output on the ESP32 and then one of the first steps in the code is to pull down that pin for a short while to reset it.
I think what is happening is that when you first switch on the project the sensor is reset by its own power on reset mechanism but when you do the software reset of the ESP32 the sensor is not also reset, hence why I think you need to do it as I described above.
Good afternoon,
I am trying to communicate through WiFi with ESP8266 module on Arduino. So far I have succeded to make my hardware setup and a very basic communication in between Arduino and ESP8266 module. I am using SoftwareSerial library to communicate, however the data outputs printed to the Serial seems quite corrupted, even though the module succesfully connects.
When I sent AT+CWJAP="AndroidAP","52689785" on Serial console, this is the output:
AT+CWJAP="AndroidAP","52689785"
AT+C⸮⸮P⸮⸮⸮⸮⸮⸮⸮ѕ͉b⸮⸮⸮⸮⸮⸮ѕ⸮ɂ⸮⸮j
WIFI DISCONNQ(UH⸮WIFI CONNECTED
WHFI GOT IP
OK
Below is my full code, I communicate with ESP module through pins 10 and 11:
#include "SoftwareSerial.h"
SoftwareSerial softSerial(10, 11); // RX, TX
void setup()
{
Serial.begin(9600);
// Serial.setTimeout(30);
softSerial.begin(115200);
// softSerial.setTimeout(30);
while(!Serial);
}
void loop()
{
if (softSerial.available())
{
String message = softSerial.readString();
Serial.print(message);
}
if (Serial.available())
{
String message = Serial.readString();
Serial.print(message);
softSerial.print(message);
}
}
I would appreciate if you could show me the solution for a better communication in between Arduino and ESP module, thanks!
Most of the ESP8266 modules will be working better at 115200 baud rate.
The reason for gibberish output can be:
either you may be viewing output at 9600 baud rate
visit the link
Device : Arduino UNO WiFi Developer Edition.
IDE: Arduino IDE 1.8.2
OS : Windows 7 64 bit
I have an issue with my Arduino device where it simply stops printing to serial and the Wifi console output is just garbage text/weird characters. Here example codes of it working and when it's not working:
WORKING
#include <UnoWiFiDevEd.h>
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println("Testing...");
delay(5000);
}
NOT WORKING
#include <UnoWiFiDevEd.h>
void setup()
{
Serial.begin(9600);
Ciao.begin();
}
void loop()
{
Serial.println("Testing...");
delay(5000);
}
What I have tried:
Reset
Firmware Update
Unplug/Replug device
Change port
Change board to NodeMCU or ESP8266
Download and re-install IDE
Reboot Laptop
Uninstall & re-install device drivers
Try previous Arduino Uno Wifi Dev Ed library
Restart/Reset WiFi
Garbage text WiFi console:
Any suggestions, ideas and solutions would be great.
Try resetting [connectivity] parameters. Click on [CONNECTIVITY], then fill in:
Server port: 1883
Client ID: arduino
Client Timeout: 2
Keep Alive: 60
Topic: arduino
[v] ENABLE SLIP...
Click on both [UPDATE] buttons, and ensure that parameters are registered.
enter image description here
I am using arduino uno to make a sound detector.
I uploaded a program, found error in the code that it returns unintended numbers unreasonably big. I also think I used wrong code for the module, but it was connected in the way that can work properly with the proper code.
The code I uploaded was:
const int ledPin =13;
const int middleValue = 512;
const int numberOfSamples =128;
int sample;
long signal;
long averageReading;
long runningAverage = 0;
const int averagedOver = 16;
const int threshold=400;
void setup(){
pinMode(ledPin, OUTPUT)
Serial.begin(9600)
}
void loop(){
long sumOfSquares = 0;
for (int i=0; i<numberOfSamples; i++){
sample = analogRead(0);
signal = (sample - middleValue);
signal *= signal;
sumOfSquares += signal;
}
averageReading = sumOfSquares/numberOfSamples;
runningAverage=(((averagedOver -1 )*runningAverage)+averageReading)/averagedOver;
if(runningAverage>threshold){
digitalWrite(ledPin, HIGH);
}else{
digitalWrite(ledPin, LOW);
}
Serial.println(runningAverage);
}
When the arduino suddenly stopped sending serial numbers, I pressed reset button and uploaded the default code:
void setup() {
}
void loop() {
}
but now it shows that it cannot connect to COM3 (arduino) and cant find the device, When I can see arduino uno successfully connected to PC using device manager (windows 8.1). The led light of arduino also turns on when I connect it to power source or usb.
it shows "port not found" when I click to see the serial output
Did I just fry Arduino?
How should I fix this?
Also, i checked the led pin 13 blinking three times when i plug in the usb. I just cant upload anything
What worked for me:
Tools>Port>(your COM)
Just selecting that solved the error.
You should do a few checks in order to jump to a conclusion, your Arduino may be just fine. As far as I know, Code cannot destroy a controller.
Check if any other software is using the same serial port. Two softwares cannot use the same serial port at the same time
Restart your PC and then try again
Remove the Microcontroller from the board, connect it to the PC and try to open the com port. If it opens then connect your Tx pin with the Rx pin, send some data and check if you are getting the data back. This way you will ensure your USB-TTL converter is fine
If this goes successful, then insert your microcontroller in some other board and check if it is getting programmed
I am sure after these checks you will find out the reason of the failure of your board/microcontroller.
Yes, check everything.... especially the USB cable or the USB port. It is crucial. My problem was just dirt on the computer USB port. Dirt, dust and grime. Crazy isn't it ? Just clean up the USB port and connector and the problem solve.
I also had a same problem and solved it.
try this one.
1. disconnect all cables from your arduino
2. connect external power
3. connect usb cable
4. then upload it.
I used my arduino with CNC shield(GRBL) and plugged external power to arduino.
after this. it was not possible to upload new firmware to arduino with usb cable only.
Once you success to upload with usb + external power then you can upload any firmware with usb cable only.
To solve the problem.
Method-1:
Go to Tools>Port>Select the Port
Method-2:
Unplug your board and plug it back in.
Method-3:
Restart your computer or laptop and reinstall Arduino software.
For more details you can visit "https://arduinopoint.com/fix-most-common-error-uploading-to-arduino/"