Activating 240v relay kills serial communication

I'm using a 240v relay to control the motor from a coffee grinder. Everything is connected correctly. The relay turns on and off when the motor is unplugged and the motor turns on when it is plugged in, but once the motor starts I lose serial communication with the Arduino. After restarting the Arduino, everything works.

This is the error that the serial monitor gives me when the Arduino stops responding: Error inside Serial.serialEvent() Bad file descriptor in nativeavailable at Method) at$SerialInputStream.available( at at at Method) at$

Does anyone know why activating the relay would kill the serial port, but nothing else?

Two possible problems spring to mind:

Are you possibly drawing too much current from the Arduino board when the relay is engaged ? This will reset the Arduino board and of course also kill serial communication.

Another possibility is that electric noise from the relay / motor is messing up the serial communication.

When you say the board will reset due to having too much current drawn from it, are you referring to the USB fuse which protects the computer or something else?

Once the connection is lost, I can't reestablish it until I manually reset the Arduino, i.e. by unplugging it from the USB port and plugging it back in. Would this not indicate that the board isn't simply resetting, but undergoing some other problem?

Additionally, the motor doesn't stop. If the board were to reset, it should turn the relay off and kill the motor once it restarts. Instead, everything continues to operate, but the Arduino refuses all serial communications.

I haven't tested for noise yet, but does any of this behavior point toward a clear solution?

Do you get the same behaviour when you have just the relay, but not the motor?

Everything is connected correctly

And that would be... how?

i.e. by unplugging it from the USB port and plugging it back in.

That sounds like you are overloading something. How are you driving the relay, you need a transistor or FET.

If it is noise then look at:- For decoupling advice.

Do you get the same behaviour when you have just the relay, but not the motor?

No, with the motor detached, the entire system operates as expected.

And that would be... how?

Here is the circuit I'm using, with the motor attached at the 'load' terminals, the JP2 pin 2 connected to the Arduino's digital IO pin 7, all RAW connected to the Arduino's 5v power line, and all GND connected to the Arduino's ground power line: Here is a guide which utilizes that circuit:

If it is noise then look at:-

Thanks for the link.

I have the same problem using 120volts, was working fine for days.

Did you ever figure this out?

Obviously, I can see that Twernmilt has not returned, hence why I asked him...

Cool profile picture though! ;)