AnalogWrite() Uno and Nano value of 240 // Sketch

hello everyone ...

I would like to control a motor. I noticed when I use the arduino uno that the rotation speed with analogwrite (240) turns faster than when I use the arduino nano 33 ble with the same code.

Why does the motor of the arduino nano 33 ble turn more slowly with the same pin assignment.

#define drehrichtungMotorLinks 6
#define drehrichtungMotorRechts 7
#define drehgeschwindigkeitMotorLinks 9
#define drehgeschwindigkeitMotorRechts 10

void setup(){
  //TCCR2B = TCCR2B & 0b11111000 | 0x01;         // Timer 2 zu 31300HZ. Timer 2 kontrolliert  die Pins 9 und 10
  pinMode(drehrichtungMotorLinks, OUTPUT);     // Drehrichtung des linken Motors vorgegeben
  pinMode(drehrichtungMotorRechts, OUTPUT);    // Drehrichtung des rechten Motors vorgegeben

  void loop(){

         digitalWrite(drehrichtungMotorLinks, HIGH); 
         digitalWrite(drehrichtungMotorRechts, HIGH);  
        analogWrite(drehgeschwindigkeitMotorLinks, 240);
        analogWrite(drehgeschwindigkeitMotorRechts, 240);

Could it be due the fact that the Nano 33 is a 3.3V device, as its name implies, whereas the Uno is a 5V device ?

How is the motor powered and connected to the Arduinos ?

oh yes, the operating voltage is lower for arduino nano than for a uno. how can I fix the problem that still rotates faster?

The Arduino nano is directly connected to a motor driver. this motor driver is then directly connected to the brushless DC motor.

Do you use something like this? This can be powered separately.

this is what I used: motor driver of: tmcm 1630 and a voltage converter: velleman k1823 to reduce the voltage of the battery from 36v to 9v input voltage.

@horemansp // @UKHeliBob

Where does the power for the motors come from ?

the motors are powered by a lithium ion battery with 36 volts. the arudino nano is then connected to an input voltage of 12 volts via a voltage converter.

@horemansp // @UKHeliBob

Your description is becoming quote complicated to follow

Please post a schematic of your project. A photo of a hand drawn

@horemansp // @UKHeliBob

better to understand?

Thanks, but we could do with more detail. For instance, is there a common GND between all of teh devices ?

all devices are connected to the same gnd. with the arduino uno it works without any problems with the code only with the nano it runs very, very slowly.


Which input of your TMCM-1630 do you use?

I'm sorry but for a project of this level, you must have a schematic.

PLEASE, include ALL power connections and label ALL connections to Nano, motor drivers and DC-DC converter.

This will help us to give some more informed answers.

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

Yes, that diagram is called a BLOCK DIAGRAM, and is useful to describe the concept of the project, but a SCHEMATIC, or CIRCUIT diagram shows all the internal detail needed to probe, verify or even to assemble the project.

You must answer this question.

What I see in the documentation for pin2 would indicate that there will be a difference between the 5v and 3.3v pwm.

2 Velocity analogue Used for velocity control in stand alone operation by
supplying external 0 – 10V signal

Problem was solved. The problem is that the operating voltage of nano is designed for 3.3 V. and not 5 V. Therefore the input voltage of the motor driver had to be increased. Thanks anyway for the help and for the tip on how to post a post next time.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.