ESP8266 shutdown after compile - arduino

I have a big problem with esp8266-1.
Im updating code (any code, even "hello wordl") to esp8266. It was working for some time (sending temp reads from dallas temp through MQTT to RPI3) and now every upload to esp8266 has effect in interruption in any wireless comunication port: mwireless mouse has big problems, wifi is jammed.
What i did wrong?
Here some simple code:
#define pirPin 2 // Input for HC-SR501
int pirValue;
void setup() {
pinMode(pirPin, INPUT);
}
void loop() {
Serial.print(" Checking...");
pirValue = digitalRead(pirPin);
Serial.println(pirValue);
delay(1000);
}
Conection is good, becuse i madenter image description heree some sort of programming station for it with adapter, so i only pull it in to program.
Arduino setup

try this: add a capacitor in between VCC and GND. Pullup all the GPIO pins. Check the rest pin have floating values? if so pull up the reset pin too!

Related

Arduino - Garbled serial output even at 9600 baud

I am doing a project that requires the Arduino to read data from a potentiometer. I was trying to get the potentiometer working so I used this code, which should read the potentiometer and then output it to the serial monitor.
int val = 0;
void setup(){
Serial.begin(9600);
}
void loop(){
val = analogRead(A1);
Serial.println("Head " + val);
}
I used the code from https://www.arduino.cc/en/tutorial/potentiometer and changed the code from blinking an LED to outputting the value to Serial where I Am monitoring it using the Arduino IDE's Serial monitor tool and all I get is this
⸮⸮>W07⸮⸮7M⸮⸮⸮[+⸮⸮⸮⸮⸮⸮z⸮R⸮⸮⸮a~⸮⸮yo6|⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮߉⸮[⸮}⸮⸮⸮⸮⸮7⸮%
G2⸮{⸮⸮⸮⸮⸮ݪ}⸮⸮⸮>⸮⸮{⸮K⸮ݻ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮?⸮⸮⸮:w⸮⸮⸮⸮6⸮⸮⸮⸮O⸮⸮⸮⸮?w⸮⸮07⸮⸮7M⸮⸮⸮[+⸮⸮⸮}<⸮z⸮R⸮⸮⸮a~⸮⸮yo6|⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮߉⸮[⸮}⸮⸮⸮⸮⸮7⸮%
G2⸮{⸮⸮⸮⸮⸮ݪ}⸮⸮⸮>⸮⸮{⸮K⸮ݻ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮?⸮⸮⸮:w⸮⸮⸮⸮6⸮⸮⸮⸮O⸮⸮⸮⸮?w⸮⸮07⸮⸮7M⸮⸮⸮[+⸮⸮⸮}<⸮⸮m⸮M⸮⸮jo⸮⸮⸮⸮⸮.⸮⸮⸮⸮d⸮⸮o⸮⸮⸮⸮⸮.|⸮}⸮⸮⸮啺7|g⸮⸮⸮⸮~⸮⸮⸮:⸮N⸮?⸮{⸮n.o⸮⸮e6⸮?l⸮⸮h⸮⸮⸮⸮ϻ⸮⸮⸮⸮ԟy⸮⸮⸮o7s7⸮?u⸮⸮⸮?⸮⸮⸮⸮߰⸮⸮⸮⸮⸮~߹h⸮⸮⸮ӿw⸮⸮g⸮⸮⸮T⸮z⸮⸮|⸮t⸮⸮⸮^⸮-⸮o⸮/=⸮ݩ⸮i⸮H⸮⸮ם⸮E⸮⸮ݛ⸮筷?⸮⸮⸮⸮⸮G}⸮⸮U⸮6⸮⸮ۮ⸮2׳⸮⸮⸮⸮G}⸮⸮⸮⸮⸮⸮⸮=⸮j⸮k⸮⸮>⸮2X⸮⸮J⸮⸮⸮{⸮⸮⸮⸮⸮n⸮⸮⸮⸮i{⸮>⸮}⸮⸮{⸮⸮⸮⸮⸮⸮j⸮⸮⸮;⸮⸮un⸮⸮⸮⸮⸮⸮⸮_7⸮⸮⸮⸮y⸮/⸮/⸮⸮⸮u⸮yvN⸮F⸮շy⸮⸮⸮g⸮⸮n⸮o⸮⸮⸮⸮l⸮7⸮nw⸮⸮/⸮⸮⸮⸮⸮⸮⸮⸮{,⸮⸮⸮|⸮⸮⸮⸮⸮eſ
⸮⸮⸮⸮⸮j⸮⸮}⸮⸮⸮z⸮]٫ϛ⸮⸮⸮⸮⸮⸮⸮ݶ⸮⸮ܟ⸮⸮⸮=c⸮o⸮g⸮l^⸮⸮ƭߛ⸮?⸮[9w⸮\[⸮⸮y⸮⸮⸮⸮⸮3⸮yѷ⸮⸮⸮g⸮}⸮⸮⸮⸮⸮⸮v⸮⸮⸮]>_⸮⸮⸮ױs⸮'~⸮i;W⸮⸮⸮⸮1ֽܢ⸮⸮⸮'⸮⸮t⸮u⸮⸮]⸮_ڙͿo⸮y⸮W⸮ٗ⸮K⸮⸮_⸮⸮⸮⸮:⸮|M⸮⸮⸮⸮G⸮⸮⸮⸮⸮N⸮⸮⸮⸮⸮⸮⸮<⸮⸮⸮w^⸮⸮⸮⸮⸮⸮e⸮⸮⸮"⸮⸮Xg⸮N⸮n⸮⸮⸮⸮⸮߷⸮⸮⸮⸮⸮⸮⸮⸮c⸮⸮~⸮⸮⸮⸮⸮⸮.⸮>⸮⸮⸮⸮⸮⸮⸮n⸮⸮?7?_⸮⸮⸮'>⸮⸮k|ۉ.⸮췅⸮T⸮ϝ⸮=⸮⸮⸮⸮⸮⸮׿}⸮⸮⸮Y⸮⸮Z⸮⸮⸮⸮⸮C⸮⸮9⸮v⸮⸮~>⸮⸮⸮Z⸮z?⸮⸮⸮⸮⸮⸮^⸮Ӿ⸮Md⸮⸮⸮⸮⸮MZK⸮j⸮⸮M⸮׳⸮⸮⸮⸮⸮⸮⸮]/Wꣷ⸮?⸮;o⸮u⸮⸮9⸮⸮⸮Y˧⸮{⸮W⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮ݮYn⸮ο⸮⸮⸮⸮⸮;⸮⸮⸮7{}⸮v⸮⸮⸮⸮⸮⸮⸮v⸮⸮7⸮⸮⸮}O+Y+⸮^⸮⸮⸮⸮⸮⸮q⸮⸮z^\⸮⸮~⸮⸮⸮⸮⸮~~⸮⸮⸮⸮⸮⸮o⸮⸮⸮⸮⸮t⸮⸮⸮⸮⸮⸮⸮L⸮⸮⸮⸮⸮⸮⸮+=⸮⸮⸮C⸮⸮Ƭ⸮⸮⸮⸮⸮⸮⸮W⸮⸮⸮/⸮⸮⸮5⸮~{{⸮|.⸮;P⸮⸮p⸮⸮⸮⸮⸮⸮⸮oZ⸮⸮⸮⸮⸮⸮⸮⸮ߝ⸮⸮⸮⸮⸮⸮⸮⸮g⸮⸮⸮⸮⸮W⸮Wj⸮oY⸮;⸮⸮/?⸮⸮~⸮6⸮⸮m⸮⸮~⸮⸮⸮k⸮_O⸮߃⸮b⸮m⸮⸮kӾ?⸮l⸮⸮⸮⸮⸮⸮⸮⸮X׬>{a⸮⸮[k#⸮/⸮~ݍ⸮⸮⸮⸮_⸮⸮O_⸮9⸮⸮⸮⸮t⸮⸮g⸮⸮⸮⸮*⸮1⸮⸮⸮⸮⸮wߝ;⸮z⸮⸮⸮⸮⸮?⸮2⸮⸮⸮⸮O⸮c⸮⸮䝿⸮⸮⸮_Ŭ⸮⸮׹զޫ:⸮⸮旚⸮⸮r⸮⸮oo⸮⸮7⸮⸮⸮O,⸮G~⸮⸮.5⸮⸮⸮,⸮w⸮o⸮⸮⸮A⸮⸮⸮⸮⸮⸮uo⸮⸮⸮?o븨⸮⸮yp⸮~W⸮o⸮⸮⸮iH2⸮⸮8⸮⸮w⸮{⸮⸮C⸮F;⸮⸮!⸮?⸮⸮;⸮⸮⸮⸮⸮⸮⸮m٫⸮?o⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮ϻ⸮o.⸮⸮⸮⸮c⸮⸮⸮⸮⸮ߴ⸮q"S{⸮c⸮ٻ⸮⸮⸮H⸮~⸮⸮[⸮⸮~⸮⸮⸮}⸮w4⸮⸮⸮⸮⸮⸮⸮⸮%⸮⸮⸮⸮⸮t쟕v⸮⸮>⸮⸮⸮⸮⸮⸮oY⸮⸮⸮⸮⸮⸮~c⸮⸮a⸮⸮⸮^q⸮⸮⸮⸮⸮׍⸮⸮⸮ޟәw_⸮⸮O⸮⸮e⸮⸮⸮V⸮⸮⸮⸮⸮o⸮⸮uy⸮8⸮⸮gޟ⸮_⸮⸮w⸮⸮⸮⸮.
⸮⸮⸮⸮⸮⸮⸮r⸮R⸮?ݍ⸮⸮⸮͖⸮⸮⸮⸮:;_⸮⸮{⸮^⸮m⸮⸮E_*⸮⸮⸮[⸮⸮\wU⸮g.}⸮ۻ/?⸮⸮}j⸮⸮⸮w⸮⸮⸮⸮⸮⸮⸮⸮⸮·⸮y{>⸮⸮#}⸮⸮⸮⸮U⸮⸮⸮⸮⸮|o⸮Q⸮\⸮⸮'⸮ ⸮⸮⸮⸮iZo_⸮⸮⸮⸮⸮8⸮⸮⸮⸮⸮=⸮⸮}zݽ⸮Q⸮w⸮⸮⸮^⸮⸮t⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮|'⸮⸮T⸮⸮⸮⸮ߩ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮ ?⸮3⸮⸮⸮⸮s}⸮⸮⸮⸮⸮߽⸮v⸮⸮⸮⸮⸮"⸮⸮>⸮⸮N?⸮ד⸮⸮_W⸮o⸮⎼⸮w⸮G|;⸮V⸮⸮⸮⸮⸮{Jg⸮⸮⸮~⸮⸮⸮⸮⸮W⸮3⸮⸮?⸮݌⸮s⸮ew⸮{⸮⸮!⸮⸮g⸮⸮⸮⸮⸮⸮⸮K⸮⸮_⸮⸮⸮⸮V7⸮j[mFԿA⸮q⸮⸮⸮lc⸮⸮⸮.⸮⸮N_ۿ⸮⸮⸮⸮fs}⸮{⸮⸮]⸮Ѷݧ⸮⸮⸮훽⸮⸮n⸮7⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮u⸮⸮⸮=⸮⸮r⸮;⸮~⸮⸮⸮⸮=⸮⸮{uߥܽ⸮⸮⸮⸮9⸮⸮⸮.ӷ⸮⸮⸮޹⸮7⸮⸮S⸮;⸮⸮⸮⸮⸮vy⸮⸮e⸮⸮⸮⸮⸮⸮s⸮n⸮⸮_<⸮⸮5Q⸮⸮⸮⸮=⸮{{⸮⸮N⸮⸮⸮sߛ⸮⸮⸮⸮⸮v⸮⸮⸮N⸮⸮#z⸮m⸮⸮⸮Q⸮⸮⸮Wq⸮⸮g⸮⸮O⸮⸮~⸮⸮⸮⸮m⸮⸮⸮⸮>W⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮p⸮⸮⸮⸮꿿⸮⸮⸮⸮^⸮⸮⸮⸮⸮E[:}⸮⸮⸮o_⸮⸮⸮⸮~⸮⸮?⸮⸮⸮⸮6⸮⸮⸮⸮⸮V⸮z⸮⸮?⸮5⸮~O⸮⸮=⸮⸮⸮⸮f⸮⸮⸮7⸮⸮⸮⸮Z]O⸮⸮ֻ⸮⸮⸮s⸮g[g⸮⸮⸮⸮?sN⸮x⸮⸮⸮⸮⸮0>⸮⸮⸮⸮⸮⸮⸮⸮_⸮⸮⸮e
v?⸮⸮j⸮o⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮߅⸮[⸮⸮t⸮3⸮⸮y⸮⸮8~⸮⸮J-4⸮v⸮?⸮⸮ֺ[⸮⸮⸮⸮N%{⸮⸮⸮⸮]⸮wxY/⸮vw⸮⸮⸮.⸮⸮e]⸮⸮{⸮⸮⸮w⸮⸮⸮⸮⸮e⸮9⸮n⸮>⸮Y!⸮⸮⸮s]⸮⸮⸮7t%⸮⸮ǿ⸮⸮⸮⸮⸮_⸮ӷ⸮⸮⸮⸮MC7⸮⸮N⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮u⸮u⸮χu⸮⸮⸮uT}⸮⸮⸮w⸮⸮⸮⸮⸮ߗ⸮o⸮⸮⸮LG⸮^^M⸮⸮n_⸮⸮t~q⸮⸮⸮~U~~`⸮l⸮-߷⸮l⸮⸮K⸮G⸮⸮⸮⸮⸮U⸮⸮⸮⸮⸮⸮ҟ='⸮⸮⸮}Ç
⸮7uO⸮⸮⸮⸮o⸮⸮⸮U_⸮⸮⸮⸮⸮;⸮⸮⸮߼_⸮⸮⸮⸮މ⸮⸮⸮y⸮{⸮W>m_⸮s⸮⸮⸮⸮-ߕȺ⸮'oN_U⸮⸮Ϳ⸮/}t⸮mo~⸮⸮sz⸮⸮⸮⸮⸮⸮~⸮_⸮⸮⸮⸮ù޿⸮&⸮⸮⸮?⸮s⸮y⸮⸮⸮7⸮⸮⸮⸮⸮⸮}⸮⸮⸮⸮⸮w⸮⸮⸮_⸮⸮⸮⸮⸮⸮⸮z⸮⸮⸮⸮L⸮⸮⸮⸮⸮⸮{⸮⸮go⸮z⸮⸮⸮⸮⸮⸮o⸮⸮⸮~⸮i⸮⸮7⸮⸮~⸮⸮M⸮⸮⸮⸮⸮⸮⸮⸮⸮v⸮⸮y⸮⸮⸮⸮޿⸮⸮⸮⸮2ߏ⸮⸮⸮⸮W⸮x⸮⸮⸮^}⸮U⸮⸮⸮J⸮w⸮⸮⸮⸮kya⸮⸮⸮N}?f⸮e⸮{⸮⸮⸮⸮k⸮⸮⸮2⸮>⸮~⸮⸮⸮⸮⸮⸮⸮⸮⸮i⸮⸮⸮⸮⸮⸮ζ⸮⸮⸮k⸮⸮w⸮⸮⸮⸮⸮⸮⸮Y⸮⸮wi⸮梲ܻ|?w⸮⸮ߥ⸮W⸮⸮⸮⸮eOӞ⸮⸮⸮z⸮⸮⸮o⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮7⸮⸮-J⸮⸮⸮⸮⸮⸮⸮+ڏ⸮⸮߿⸮j⸮}⸮9⸮?⸮⸮⸮[X_⸮⸮⸮⸮⸮⸮⸮.⸮⸮⸮⸮⸮n⸮;⸮ߝP⸮⸮⸮p⸮H⸮F[~⸮⸮⸮⸮⸮⸮⸮zL⸮⸮⸮⸮⸮⸮ݗ⸮⸮w|^⸮⸮⸮]⸮_⸮⸮⸮k⸮⸮⸮⸮U⸮o4⸮⸮mn⸮⸮>⸮⸮⸮[⸮3⸮/⸮w⸮淯⸮⸮⸮}wD⸮⸮f쿋⸮⸮z⸮⸮H⸮cP⸮YÜ5⸮y⸮?~⸮⸮⸮⸮⸮⸮⸮⸮⸮M}⸮⸮wiP#⸮⸮}⸮L⸮⸮⸮ynx|^⸮wn⸮=⸮泩⸮⸮⸮C⸮⸮⸮⸮⸮~ݳ⸮׍D⸮[⸮⸮⸮,⸮kGȯ⸮⸮⸮Q⸮⸮u⸮⸮⸮O|⸮⸮⸮⸮⸮_|?⸮⸮⸮⸮~ʖ9⸮⸮⸮⸮⸮tNW⸮⸮⸮⸮⸮⸮⸮⸮v⸮⸮e⸮⸮s⸮⸮W⸮⸮⸮⸮~⸮~⸮⸮e⸮⸮⸮⸮⸮⸮⸮q%⸮⸮⸮⸮U⸮=⸮⸮⸮?⸮⸮'⸮⸮`⸮⸮⸮⸮⸮⸮⸮⸮~⸮⸮⸮ɋ⸮⸮{⸮⸮⸮C⸮⸮'⸮Mn⸮ٷ>⸮}⸮⸮⸮⸮⸮⸮⸮ߜ⸮⸮⸮]ڞ⸮ ߶_8⸮⸮⸮⸮{.⸮⸮⸮⸮S\+⸮vSǏ⸮⸮⸮⸮⸮^⸮⸮\⸮_⸮⸮⸮˫m⸮^⸮⸮=o⸮ůw_yݨ⸮⸮⸮⸮뿜9?_⸮⸮⸮⸮⸮٧⸮⸮⸮⸮⸮ǜ⸮ήo⸮⸮f>⸮~5⸮⸮~⸮v⸮v߿?Z⸮%
⸮{⸮|⸮⸮⸮⸮~ou⸮⸮⸮⸮T⸮No⸮⸮⸮⸮⸮⸮ֹi&;⸮⸮⸮⸮⸮⸮ޛ⸮⸮⸮⸮⸮;⸮⸮⸮⸮⸮⸮⸮?⸮⸮^⸮w;⸮⸮⸮⸮ÿ⸮⸮⸮7⸮⸮⸮⸮⸮ׯ}⸮⸮8⸮⸮⸮F⸮⸮⸮⸮⸮⸮⸮⸮Z⸮⸮??⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮n⸮⸮⸮⸮ _⸮⸮⸮⸮⸮⸮s{⸮⸮⸮⸮U⸮⸮wmt[o⸮7f⸮⸮⸮⸮⸮⸮R⸮⸮⸮L⸮|>⸮M0⸮⸮v⸮%v֟}⸮⸮⸮j7⸮⸮⸮⸮⸮⸮⸮e{n⸮⸮⸮⸮{⸮⸮⸮⸮⸮⸮N}}⸮⸮CsLB⸮⸮⸮j⸮⸮x輣⸮⸮⸮⸮⸮⸮#_⸮y⸮⸮⸮⸮⸮⸮P⸮⸮⸮Z⸮(6⸮_⸮[K<⸮ם⸮_⸮{⸮⸮싛⸮߼5:?k⸮⸮߿⸮~⸮ɫ⸮⸮⸮~⸮⸮⸮K⸮⸮⸮⸮⸮⸮⸮⸮⸮x񭳶⸮⸮9⸮ɖ⸮⸮⸮]⸮⸮⸮|[⸮⸮?⸮⸮>eOs⸮⸮⸮⸮Z⸮⸮⸮⸮⸮⸮A?3⸮⸮⸮⸮⸮~⸮⸮[⸮⸮⸮⸮8<⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮}69?⸮⸮⸮⸮K⸮⸮⸮Sb⸮eJ⸮⸮oO⸮⸮''⸮⸮⸮뷳⸮O⸮⸮⸮⸮G_⸮⸮⸮.⸮⸮{⸮⸮
It works fine when using the original code.
Please Note:
First make sure that the baud rate used in the sketch is same as the baud rate used in the Serial Monitor
Use a delay of 10 milliseconds for stability: delay(10);
The val variable is int, so better to use Serial.printline with String Constructor as:
Serial.println("Head " + String(val);
The baud rate in your code and the baud rate chosen in the Serial Monitor window are different. make sure they match and the output should then be legible.

RCSwitch library seemingly not working for 433 Hz receiver on ESP32 NodeMCU

I'm pretty new to Arduino and especially ESP32. But - before I receive the tip "use an Arduino" - I decided to go for the ESP32 because of the size and the capability to connect it to the WLAN.
However, I am trying to build some control box for my terrarium which should - in the first design - steer various lamps and the rain pump via remote controlled outlets. For this I got an ESP32 NodeMCU, a RTC time module (which seems to work quite fine) and a 433 Hz receiver/sender set.
I followed several tutorials regarding the wiring and uploaded the example files to the ESP32. No matter which pin I connect the Receiver to (I need to connect the receiver first in order to read out the signals of the 433 Hz control which came with the outlets) I won't receive any signals on the receiver.
I embedded the library RCSwitch and I tried to configure my switch as follows (here with PIN 13 as example - I tried several other pins as well):
mySwitch.enableReceive(13)
As I read in some other blog, there might be the need to convert the pin number to its interrupt address, so I tried the following:
mySwitch.enableReceive(digitalPinToInterrupt(13))
The result is always the same: dead silence on the serial monitor (except the boot messages, etc.).
Am I using the wrong library or what am I doing wrong here?
I read that there should be a library called RFSwitch, but the only version I found only features the 433 Hz sender, not the receiver.
I would be really grateful for any hint concerning this issue - I'm pretty stuck here for many hours now...
I know this is pretty old and maybe you've resolved the issue by now but maybe it will help others. I had the same issue and what helped me was to set the pinMode:
pinMode(GPIO_NUM_35, INPUT);
mySwitch.enableReceive(digitalPinToInterrupt(GPIO_NUM_35));
Have been successful with RCSwitch today on ESP32 Dev Board and a 433MHZ receiver and sender. Here is what I have been stumbling on my journey.
Connecting the receiver (requires 5V)
You can use the ESP32-VIN for 5V if the Micro-USB is used to supply power
You may connect the Receiver-DATA to any ESP-32-Input-PIN BUT you might damage your ESP32 since it only allows ~3.3V
I tried first with some "makeshift" level shifting through resistors but I guess it lowers speed too much => A proper level-shifter (5V => 3.3V) might work out well
When referencing the PIN "xx" I have been just using the PIN-Number "Dxx" written on the ESP32-Dev-Board
You may connect an antenna of ~17.3cm to improve range
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
#define RXD2 27
void setup() {
Serial.begin(115200);
Serial.print("Ready to receive.");
mySwitch.enableReceive(RXD2);
}
void loop() {
if (mySwitch.available()) {
Serial.print("Received ");
Serial.print( mySwitch.getReceivedValue() );
Serial.print(" / ");
Serial.print( mySwitch.getReceivedBitlength() );
Serial.print("bit ");
Serial.print("Protocol: ");
Serial.print( mySwitch.getReceivedProtocol() );
Serial.print(" / ");
Serial.println( mySwitch.getReceivedDelay() );
mySwitch.resetAvailable();
}
}
In your RC and Outlet can be configured by DIP-Switches you might not need to connect the receiver overall - you can directly insert the DIP-Switches levels in the RCSwitch-Library
Connecting the sender (is fine with just 3.3V)
You can use the ESP32-3.3 to supply power
You may want to double check the PIN-Labels - I got confused because the DATA-Label was off and first interpreted as GND | DATA | VCC instead of GND | VCC | DATA
You may connect an antenna of ~17.3cm to improve range
#include <Arduino.h>
#include <WiFi.h>
#include <RCSwitch.h>
#define TXD2 25
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(115200);
// Transmitter is connected to Arduino Pin #10
mySwitch.enableTransmit(TXD2);
// Optional set protocol (default is 1, will work for most outlets)
// mySwitch.setProtocol(2);
// Optional set pulse length.
mySwitch.setPulseLength(311);
// Optional set number of transmission repetitions.
// mySwitch.setRepeatTransmit(15);
}
void loop() {
/* See Example: TypeA_WithDIPSwitches */
mySwitch.switchOn("01010", "10000");
Serial.println("Switch On");
delay(10000);
mySwitch.switchOff("01010", "10000");
Serial.println("Switch Off");
delay(10000);
}
I have not yet used sender or receiver while WiFi being active. Though I have been reading about issues while WiFi is active and receiving / sending via 433Mhz.
The sender must have 5 V supply to go far, and it has not output pin which can damage the ESP32, and the receiver. Instead, must be connected to 3.3 V because it has an output which goes to ESP2 (3.3 V supply) and the output of the receiver must not be more than 3.3 V, so as not to damage the GPIO input of ESP32.
ESP32
The data sender(input) goes to: GPIO 5: pinMode(5, OUTPUT)
The data receiver (output), goes to GPIO 4: pinMode(4, INPUT)
Sender supply: 5 V
Receiver supply: 3.3 V (not to damage ESP32 GPIO 4)

How can we Read Power is present in wire Or not in ardunio uno?

Hey guys i had very simple question .. i am new in electronics .. i am using ardunio to send alert when electricity is present or not at my home or farm ..
i don't know how i can do that .. suppose i had an adapter which gave output of 5V 1AMP .. so how i can read that information in ardunio when power is ON in adapter .. i tried to put the RED (Anode) Wire in some of my digital pins and analog pins with DigitalRead function and AnalogRead .. but it always returning some of values .
please help us how to tell ardunio when power is on ... i need any of modules ?? to do that ?
thanks in advance for you help sorry for bad english ....
you don't need any modules to do this, you should connect the negative wire of your adapter to arduino gnd, then the positive wire of your adapter to any adrduino digital input/output pin for example pin 5, then you should connect a 10k resistor from pin 5 to arduino gnd "as a pull down resistor"
Arduino code:
void setup() {
// put your setup code here, to run once:
pinMode(5, INPUT);
pinMode(13, OUTPUT); //will use the built in led to show the result
}
void loop() {
// put your main code here, to run repeatedly:
power = digitalRead(5);
if (power) {
digitalWrite(13, HIGH);
// do other things if you want
}
}

Arduino Serial.read doesn't work

My Arduino Mega (with CH340 but all the drivers needed installed) has stopped reading from the serial port. Doesn´t matter what I write it keeps saving number 50. I have tried with simple examples codes as this one:
int incomingByte = 0; // for incoming serial data
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
}
And I get the same response.
The arduino has been working fine untill today. Serial.print() works also fine, it's just Serial.read() Anyone knows what the problem could be?? I haven't found much help on the internet, seems I am the first one dealing with this issue.
Okay, so I found what my problem was. Don't know if it was Serial.read or Serial println / Serial.write, some of these functions were converting from integers to chars, so numbers appeared to be only between 49 and 58. Using Serial.print instead it works perfectly. Thanks for the answers by the way.

Two xbee beacons drowning each other out?

I'm trying to create a pair of arduino/xbee beacons that will transmit some information (ultimately GPS coordinates) to each other at all times. The problem is that when they're both on, neither one seems to receive. I'm guessing it's because both might be transmitting at the same time and drowning the others message out. However, I'm not sure of a better approach since neither one is a slave or master. Here's my setup:
Hardware:
A pair of XBee-Pro 900 XSC S3B xbees.
A pair of teensy (arduino compatible with multiple UARTs)
XBee Setup
VID: 542D
DT: 8153
Serial connected to Serial 3 on Teensy
Code
long lastTxTime = 0
void setup() {
Serial.begin(9600);
Serial3.begin(9600);
}
void loop() {
long now = millis();
// Send ever 0.5 seconds
if (now - lastTxTime > 500) {
Serial.println("SEND!");
Serial3.println("WOOT!");
lastTxTime = now;
}
delay(100);
// Print anything received
while(Serial3.available()) {
char c = Serial3.read();
Serial.print(c);
}
}
When I connect both Teensy's to separate terminals, both of them output "SEND" and rarely receive a "WOOT". I put one of the XBees straight on a USB board to a terminal and it output most of the "WOOT" messages from the other.
What can I do to make this work?
What you need to look into is flow control. In the wireless standard, they use RTS (Request to Send) & CTS (Clear to Send). The RTS/CTS pins on Xbee might be what you need,

Resources