Unstable AC make that my arduino fail

Hi people, i have an arduino mini pro that sends information through the chip nrf24l01 to another when a button is pressed, the prototype powered by usb works fine, but when I feed it with a 5V cell phone charger fails, not always.

The problem is when you plug into the 220V network some device that consumes a lot of current, for example, the iron solder itself, switch an old light bubble or a ceiling fan, in those cases send random information without any pressed button.

any idea how to solve this?

yes!
take a good psu, the cell phone chargers often have not 5V, more 4.xV and are designed for charging.
Often also they might dont have caps for filtering / buffering.
The RF24l01 needs a 100nF + 10µF cap directly on his + and gnd.
For the RF24l01 a good psu is a must!

Try it out! You will see!

mega-hz:
take a good psu, the cell phone chargers often have not 5V, more 4.xV and are designed for charging.
Often also they might dont have caps for filtering / buffering.

OK, i will try to find another power supply

mega-hz:
The RF24l01 needs a 100nF + 10µF cap directly on his + and gnd.

yes, the NRF already has the cap, it helped me alot in the beginning with the signal quality

thanks for your answer!

any news?

mega-hz:
any news?

Yes!

A better psu didn't solve my problem, i try with a atx power supply for PC, i thought "it can supply a PC, so it must be better than my cheap charger phone, but not..

I also read somewhere that add a toroidal ferrite core in the power cable maybe work, again not..

Only works better when i change the old light bubble for a led one, but still failing with the other stuffs listed above

Next i'm gonna try is use a isolated cable for the power. Meanwhile, any more ideas?

thanks for the interest!

isn't the RF24l01 a 3.3V type?

mega-hz:
isn't the RF24l01 a 3.3V type?

Yes, it has his own 3,3 regulator. The mini pro also is a 3,3 type, is powered by 5V in the raw pin.

When i try with the atx powe supply i use the 3,3V cable direct in the vcc pin of the arduino but it didn't work either

hmmm...
did you try another RF24l01?

mega-hz:
hmmm...
did you try another RF24l01?

No, but there are four arduinos+NRF24l01 running as i describe and all fail on the same way

I don't think is a problem of the NRF module because never send garbage info, is allways a data that i programmed to be sended when every button is pushed

can we see the sketch?

mega-hz:
can we see the sketch?

sure:

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"

RF24 radio(9,10);

const uint64_t pipes = 0xABCDABCD01LL; 

void setup(void)
{ 
    pinMode(2, INPUT);
    pinMode(3, INPUT);
    pinMode(10, OUTPUT); 
    radio.begin();
  
    radio.setRetries(15,15);    
    radio.setChannel(65);
    radio.setDataRate(RF24_250KBPS);
  
    radio.openWritingPipe(pipes);
    
}

void loop(void){

  if (digitalRead(2) == HIGH){
    radio.stopListening();
    int cama = 11;
    radio.write( &cama, sizeof(int) );   
    radio.startListening();  
    delay(300);
  }
  if (digitalRead(3) == HIGH){
    radio.stopListening();
    int cama = 12;
    radio.write( &cama, sizeof(int) );
    radio.startListening();   
    delay(300); 
  }
}

i don't think there any problem here, it worked perfectly in my house, i don't understand why is failing where is now

Try this:

In the Setup:
Type

PinMode (2, INPUT);
digitalWrite(2, HIGH);
PinMode (3, INPUT);
digitalWrite(3, HIGH);

this turns on the pullup resistors on the digital ios, so maybe without those there may be interferences !

mega-hz:
this turns on the pullup resistors on the digital ios, so maybe without those there may be interferences !

ok, but i already have several external pulldown resistor like this:

the only diference is 10K was very sensitive for me, so i changed for 1k and works perfectly

i should:

  • remove the external resistors
  • change the if condition (digitalRead(x) == DOWN)
  • change the side of the button which is connected in vcc to gnd

i'm right?

Edit:

I brought one of them to my house to try again and put in a multiple plug my pc, a little stereo, my cellphone, an old bubble light, a floor fan in maximum speed and the arduino powered with the first cheap charger.

I turn everything on and off several times (i know it was dangerous for de devices, but i had to clear my doubt, and nothing mess up :slight_smile: ) and the arduino works perfectly, doesn't fail any single time

so, the only i can think is that the electrical instalation of the house where it fails is really bad. now i remember that while are making the instalation of these arduinos, when we used the drill all the lights lose a little of intensity

well, i think you made everything right with the arduinos,

you must check the mains instalation for bad connections!
Maybe Danger for Fire if there is a bad instaltion!

mega-hz:
you must check the mains instalation for bad connections!

i dont think so, the connections already been checked twice in the first instalation, and twice again in the second instalation. the sistem works perfectly meanwhile don't use the devices listed above and nothing heats up, make smoke or fail in some way, beside i have the exacly same connection here since i brought the last one to test

honestly, my brain is dry, i don't know what else to try and i already searched for everywhere. i'm done, we gonna to optimice the code to use bateries and end this mess

thank you very much for your time spent here since you are the onlyone who tryed to help me, take your deserve karma point, and thanks again

hi,

Your false positives may come form anywhere, and you may look endlessly to find the cause. I control my lighting with arduino and had similar issues (100% success in trial setup, 1% false positives in live deployment), and decided to go for polling.

Please read this reply from me to get an example of switch polling that works for me, with a mega and internal pullups.

thx,
/steven