I am fairly new to the Arduino topic and I'm trying to get a few things to work together.

At the moment I'm using an Arduino Uno board, but planning to use an Arduino Nano for this.

First I tried setting up a DC motor that can be controlled via PWM, which works perfectly when used standalone. I can start/stop the motor and change speed depending on the value I send to the PWM pin.

Next, I tried to use an RF-5V wireless receiver to work with a remote control from remote switched power outlets. For this one I followed the instructions on how to build a 433 MHz sniffer. This all by itself works as well. I can receive different codes depending on which keys on the remote I am pressing.

Now the fun part started: I wanted to integrate both projects into one, so I could use the remote to start/stop the motor. So I came up with the following circuit:

enter image description here

(The sketch is updated so it shows the right pins matching the code)

And the following code (which is partly from the instructions mentioned above):

#include <RCSwitch.h>

// init 433MHz lib
RCSwitch mySwitch = RCSwitch();
unsigned long lOldValue=0;  // to check for consecutive reads on 433MHz
int motorPin = 5; // PWM-Pin to use for motor

void setup() {
  pinMode(motorPin, OUTPUT);
  // set-up rf receiver
  // 433MHz Receiver on interrupt 0 => that is pin #2

void loop() {
  if (mySwitch.available()) {
    int value = mySwitch.getReceivedValue();
    // only react, if at least two times same value received
    if (value == lOldValue) {
      if (value == 0) {
        Serial.print("Unknown encoding");
      } else {
        Serial.print("Received ");
        Serial.print( mySwitch.getReceivedValue() );
        Serial.print(" / ");
        Serial.print( mySwitch.getReceivedBitlength() );
        Serial.print("bit ");
        Serial.print("Protocol: ");
        Serial.println( mySwitch.getReceivedProtocol() );
        // One of the keys on the remote
        if (value == 274393) {
          Serial.println("got start code, starting motor");
          analogWrite(motorPin, 100); // start the motor
        // another key on the remote
        if (value == 270384) {
          Serial.println("got stop code, stopping motor");
          analogWrite(motorPin, 0); // stop the motor
    lOldValue = value;

When I run the code and click on the remote, I get different values shown depending on the key I press. So the wireless receiver works as expected.

When I receive the right value for starting the motor, the motor really begins to turn, so this works as well.

And here the fun part starts:

As soon as I use the analogWrite function to send data to the PWM port the motor is connected to, the wireless receiver stops working (or at least I do not get any more values when pressing a key on the remote).

I found a few similar posts/problem descriptions on the net which said to try the following:

  • Use another pin for PWM (due to possible interrupt conflicts). I tried that as well, same behaviour.
  • Use external power supply instead of USB-Cable, which helped somebody resolve this issue. Not here. Does not work either.

So the question is:

Does anybody know how to combine those two things together so I can use the wireless receiver to get commands and switch on/off the motor with it on an Arduino Uno?

And would this solution probably work with an Arduino Nano as well?


I changed the motor against a LED, same behaviour. So its not related to the motor itself.

I found out that when i use some timers to set the motor pwm to 0 with the analogWrite function, that the wireless receiver starts working again. So it really looks like there is no way to use PWM and the wireless receiver together.

I also changed the pin for the receiver from 2 to 3 (and of course changed the code to use the right pin) and used other PWM pins for using with the motor. But still to no success.

Does anyone have an idea on how to bring both the wireless receiver and PWM driven things to work together? Might this be an hardware issue (due to interrupts) or a library issue for the rcswitch?

  • Most likely it is interference from the motor. You can add some EMI dampening capacitors (small, say 10nF) between the motor's pins and the metal body of the motor.
    – Majenko
    Jan 9, 2017 at 15:01
  • Double check pin assignments. Your circuit does not match sketch pin assignments. Jan 10, 2017 at 0:00
  • @MikaelPatel Yes, you are right. I did not pay the neccessary attention when drawing the circuit. But even with the cables attached to the right pins as mentioned in the sketch, it did not work.
    – Olli
    Jan 10, 2017 at 7:36
  • I give you +1 for a well formulated question and your debugging skills.
    – user31481
    Feb 20, 2018 at 12:04

1 Answer 1


You are asking too much from the Arduino if you expect it to drive a motor with only the on-board 5V regulator AND the radio. Eliminate at least the motor connection to the 5V and use a MOSFET to drive the motor with a stand-alone power source like an alkaline battery pack of at least 6V - You need current to drive a motor and the UNO is limited to 500mA. Once you PWM the MOSFET, it should handle the motor with ease. A IR510 is good for this use. You will need a 10K pull-down resistor to the Gate Pin to keep it LOW when no signal is present. This should get you going in the right direction. 0.01 ceramic filter capacitors to the - and + leads to ground around the motor is also helpful. Look up on-line how others do this.

  • That's for sure. The radio itself requires at least 100 mA.
    – SDsolar
    Sep 23, 2017 at 3:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.