433 MHz with L293D DC Motor

Hello,
I am using an Arduino Nano aus a receiver for a small car. For remote controlling the car I use a cheap 433Mhz device that uses OOK. As a test every time I receive a message (from 0 to 255) I use this message directly to pwm the DC Motor that is Connected to a L293D. When the Motor ist moving slow everything works as expected. But as soon as the motor is running faster, I can not receive any more messages. It seems like the Motor (small toy dc Motor with ~9V) is disturbing the receiver. When I let the motor run directly without being connected to the arduino, I have no trouble.
Can anyone help me? I already tried soldering a 0,1uf cap to the motor, but this does not help.

The I guess you are trying to use a toy smoke alarm battery to power you system. Not going to work. Use a battery that can supply more current.

Paul

Please post the code, using code tags, a hand drawn circuit diagram for the car, and links to the motor driver and other modules. State which battery you are using.
image posting guide

Here I have a hand drawn circuit diagram.

I see that I forgot to draw the ground and Vin for the arduino, but as this is obvious, the arduino would not even start without Vin and ground.
I use two power supplies, both should be sufficient (~9V, 1A and ~5V,1A).

Here is my code:

#include <RCSwitch.h>

//Receiver
RCSwitch mySwitch = RCSwitch();

//Motor
int speedPin = 5;
int dirPin = 6;

void setup() {
  // Receiver init
  mySwitch.enableReceive(0);

  // Motor init
  pinMode(speedPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
  //Motor direction
  digitalWrite(dirPin, LOW);

  analogWrite(speedPin, 0);
  delay(5);
}

void loop() {
  // If we received data
  if (mySwitch.available()) {
    int val = mySwitch.getReceivedValue();
    analogWrite(speedPin, val);
    delay(5);
    mySwitch.resetAvailable();
  }
}

The motor itself works totally fine with the L293D as well as the receiver. So I doubt it could be insufficient power.

Paul_KD7HB:
The I guess you are trying to use a toy smoke alarm battery to power you system. Not going to work. Use a battery that can supply more current.

Paul

No, I use a toy power plant to power my system :slight_smile:

You might try adding two more capacitors to the motor terminals, and grounding the motor frame. This tutorial shows how to add the capacitors.

The RCSwitch library was not intended to be used to send values, although that can be made to work. RCSwitch transmissions have no integrity checks and are very susceptible to interference, which is why the messages are sent many times.

VirtualWire works MUCH better and as there are integrity checks, is much less susceptible to interference.

jremington:
You might try adding two more capacitors to the motor terminals, and grounding the motor frame. This tutorial shows how to add the capacitors.

The RCSwitch library was not intended to be used to send values, although that can be made to work. RCSwitch transmissions have no integrity checks and are very susceptible to interference, which is why the messages are sent many times.

VirtualWire works MUCH better and as there are integrity checks, is much less susceptible to interference.

Thank you for your help. I did not know that VirtualWire is much better, so I will try the VirtualWire library first and then hopefully things might work better. If that does not work I will try with more capacitors. Thank you!

EDIT:
HOLY! It is working like a charm now. VirtualWire and you are the real MVPs :smiley: Thank you!

Excellent!