New answers tagged

0

That is operating as expected. Take a look at the data sheet. You can lose 1.8 volt on each output pin. Since you are in bridge configuration you now lose 3.6 Volts. Now assume your power is 6VDC with 1 volt ripple. That adds to the voltage drop through the driver so rounding it out you lose 4 volts from your supply (not counting wiring loses) before you ...


0

no pinMode(firstMotorNegative, OUTPUT) Well, here's a start at least: pinMode(firstMotorPositive, OUTPUT); pinMode(secondMotorPositive, OUTPUT); // <------ pinMode(enableFirstMotor, OUTPUT); pinMode(secondMotorPositive, OUTPUT); pinMode(secondMotorNegative, OUTPUT); pinMode(enableSecondMotor, OUTPUT); You are never setting firstMotorNegative to OUTPUT ...


1

The L2978D is a terrible motor driver (I really wish people wouldn't use it!). It is "bipolar" which means that both the high and low side switches of the H-bridge are Bipolar Junction Transistors. This means that you get about 1.4V voltage drop in total between the inputs and outputs. To counter that you must provide at least 1.4V more than your ...


0

An NPN bipolar transistor requires a current to flow from base to the emitter which is then multiplied by the beta of the transistor controlling the maximum current which flows from the collector to the emitter. A 2n2222 beta is about 100. Let us calculate the amount of current which will be allowed to flow from the collector to the emitter of the 2n2222 ...


1

Start with the BlinkWithoutDelay example code and make modifications to suit your needs. This is the original code. /* Blink without Delay Turns on and off a light emitting diode (LED) connected to a digital pin, without using the delay() function. This means that other code can run at the same time without being interrupted by the LED code. ...


0

What you're searching for is called "non-blocking programming", a technique in which you frequently test or evaluate whether something needs to be done, and either do it or not, but move on immediately. For one motor, you could block successfully (do nothing else while you wait for something to happen): start/wait/stop/reverse/wait/stop/... etc. ...


1

The simplest option is to use delay() to implement the waits: void loop() { turn_motor_on(); delay(10000); // 10 seconds turn_motor_off(); delay(600000); // 10 minutes } Since these long numbers may be difficult to read, you can make them more readable by defining some units: const unsigned long second = 1000; const unsigned long minute = ...


0

Yes, of course it's possible. The loop() function might look something like: loop(){ turn_motor_on(); wait_seconds(10); turn_motor_off(); wait_minutes(10); } Now all you have to do is write your turn_motor_on() and off functions and also wait_seconds() and wait_minutes(). I'll leave the motor controls to you since you have not provided any ...


0

The simplest approach to include a delay in your sketch is to call the Arduino delay() function. Pass this function a delay value in milliseconds. For example, a 1 second delay is 1000 milliseconds. As simple as this method is, it is not recommended if your sketch is required to accomplish tasks during the delay. This is a common requirement and ...


0

Your problem is most likely this line: irrecv.blink13(true); That is intended to flash an LED on pin 13 when you use your IR remote. However pin 13 is also used by the motor shield as part of the serial protocol to communicate with the control chips. By using that you are confusing the motor shield. Just remove that line should allow the motors to work ...


0

This may be too simple, but for completeness: You can read back the state of the output bit, in case your code doesn't save its current state. That will tell you if the motor is literally "on" or "off". Not rotating despite being "on" is another matter; an error. If you need error detection then you need additional hardware ...


1

Unfortunately, the L298N does not return a status, so you are going to have to add sensors to detect motor movement. Here are a few options you can try: Current sense. Add a small resistor to the output of the L298N and measure the voltage differential across that resistor. If there is current being supplied to the motor then you will have a voltage ...


1

Figuring out your current needs is simply a matter of adding everything up. If you have 5 2 amp motors, you'll need 5 x 2, or 10 amps just to drive the motors. You should probably have at least 20% extra capacity, so I'd suggest having a 12V power supply that can put out at least 12A. 15A would be better. The stiffer your power supply the less it will "...


0

Although your solution would work, it seems open to problems such as missed clicks, starting at a different place etc. A better, more robust and error free solution might be to use a hall sensor. Essentially what a hall sensor does is close a switch when a megnetic force is applied. So all you have to do is add a magnet to your conveyor/chain. This way, you ...


1

#include <Arduino.h> const int pirPin = 9; const int motorPin = 2; int switchState = 0; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(motorPin, OUTPUT); pinMode(pirPin, INPUT); } void loop() { while (digitalRead(pirPin) == HIGH)//this part of the code gets executed if the ...


Top 50 recent answers are included