Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

16

I'm not sure if the platform is stable enough to use it for something like this. Absolutely it is. As I describe in my post about an RFID door lock I use a Uno (and some additional parts) to unlock my door. Since writing that I improved the software as described here so you can reprogram the valid list of cards "on the fly" (without uploading new code) as ...


11

If you want to use an Arduino in this sort of environment, there are a few things to watch out for: Heat (usually from sunlight striking the enclosure). This could be relevant for your project, depending on the installation and location of the door. Choice of enclosure material, colour and finish can all affect this. Rollover of millis() (see http://...


9

You do not "stop" a servo. A servo is always running. In a general sense, the servo is a control loop that takes as input a position target and applies force to hold at the requested target. If you want the target to be maintained, then the servo must be running. A servo motor contains electronics that are internally turning a DC motor on and off as ...


7

A normal servo doesn't have a "go" function, it only has positional control. That is, whether you run servo.write(90) forever or once, the servo will go to 90 and continue to actively keep that position until you write another position. The only way to turn a servo off is: servo.detach(); For a normal DC motor, you will need to turn it on then off and ...


7

If you can guarantee that your hardware and software skills are impeccable then you can certainly trust the MCU on the board. After all, the ATMega chips aren't toys, even though many people around here seem to treat them as such. They are a professional industrial product. Of course, this is assuming that the Arduino you have is genuine and not some cheap ...


7

According to Flite Test web site, the 9g reference is the weight without the wire lead. They measured one model at 8 grams rounded down. I suspect the weight also ignores the horn as well as the wire. The article referenced on the web site calls the weight reference as a standard, which means that it more likely allows for heavier or lighter servos as long ...


7

Normal servos don't provide any feedback. Their speed depends on the servo's specs and the load. You could measure the time it takes to rotate a certain angle and use that to calculate the time, then add some safety margin. But if the load isn't constant, the times will be off. You could change the position slowly, but that still doesn't guarantee that the ...


6

I am wondering about what voltage my external power will need to be to control all of them at 6v Well that would be 6V then wouldn't it? You're asking the wrong question. The question you should be asking is: How much current will I need from my 6V power supply? And the answer is: Add up the total current required by all of the devices and that is the ...


6

You have bad Unicode characters in your code. All your semicolons are something completely different and need replacing with real semicolons.


6

Arduino's Servo library on AVR uses interrupts; if interrupts are disabled for any amount of time, the servos will twitch. 1-Wire protocol (used by DS18B20) needs to disable interrupts for the protocol to work. Therefore, servos glitch. There is a great explanation of the problem here: https://learn.adafruit.com/neopixels-and-servos/overview , just ...


5

If the problem is due to jittery pot readings, you may want to smooth the potval data sequence by code like the following, where rawreading stands for what you just read from the potentiometer's input line. potval = alpha*potval + (1-alpha)*rawreading; Set alpha to a number (eg 0.8 or 0.9 or 0.95 etc) between 0 and 1. alpha represents the fraction of the ...


5

If you have two RC servos that are always required to move together you can simply connect both control inputs to a single output.


5

Fundamentally, because the systems they were designed for convert rotary motion to linear, typically with a range substantially less than 180 degrees (probably more like 120 degrees). Next, because the control scheme of PWM position pulses is not able to convey requests over an arbitrary range - the mapping of pulse width to position must be limited, and it ...


5

A normal servo is an absolute positioning device. The position of the servo is directly proportional to the length in time of the sync pulse. This means if you tell the servo to be in a given position, it will seek that position with out regard to the initial position. It will simply figure out which way to go on it's own and stop when it gets there. I ...


5

The Arduino's GPIO pins can drive the signal of most model servos directly, without any extra transistors. Driving a model servo signal input is not the main problem with driving servos from an Arduino. The main problem is trying to use the Arduino's power supply to power the model servo. With many model servo's, the amount of current the model servo ...


5

First you have to compare the pinouts of the two shields. If the shields use completely different pins then yes, you can use them together. However if they share pins then you need to look in more detail at what those pins are and how they are being used. In your example you have SPI being used (pins 10-13) for one shield and PWM (3/11) and GPIO (8/9/12/13)...


5

Yes, that is how C and C++ (and most other C-like languages) work. Variables have "scope". Any variable define inside a pair of curly braces (between a { and a }) is only visible inside those braces. If you want to reference a variable in both setup() and loop(), you have to make it a global variable, defined at the top of your code. #include "Servo.h" ...


4

I like this method the best (personal preference) for smoothing signals: //In setup int bufferedVal = analogRead(A0); int unbufferedVal = analogRead(A0); #define _TOLERANCE_ 5 //The loop unbufferedVal = analogRead(A0); if(abs(unbufferedVal - bufferedVal) >= _TOLERANCE_ ) { bufferedVal = unbufferedVal; } This finds the error using the abs() function (...


4

Insufficient decoupling. Put a 100nF cap on the supply lines at the LCD and a 100uF cap on the supply lines at the servo.


4

Addition to Ignacio. Explanation from real life. Gregir, look at your home devices like TV, micro wave, fridge and so on. They all need 220-230 V AC and you can plug all them to one socket. As Ignacio said voltage doesn't plus. The current does plus, for ex. you have 2 servos connected in parralel, both 5V, no load current 0.1A. So to run them with no load ...


4

Because the supplies of both servos are connected in parallel, they both see the same voltage. Hence there is no "pool", both are being supplied the same 5V. There is a regulator on the Arduino which reduces the 12V input down to 5V. It does so by burning off the other [7V times however much current is being used] as heat. Since you are supplying it with 1....


4

Although I haven't looked at the source myself, in these types of situations they usually use interrupt timer 1, which in PWM mode would have been associated with pins 9 and 10. This would explain why you can't use pulse width modulation on those pins. In fact, you can use any of the three timers for PWM on any digital pin, although it's not as good as the ...


4

A0 through A5 already have GPIO capability; treat them as you would any other non-PWM pin. A6 and A7, found in similar boards that use a SMD package, do not have any GPIO capability whatsoever and can only be used for analog input.


4

Some servos are actually not able to do full 0..180 rotation - or to rephrase it better, the standard 0.5ms and 1.5ms pulse will force them to a position which can not be reached. Therefore the motor keeps on rotating in a constant struggle. change 0 to something like 20, and 180 to something like 150 check that the motor has stopped once reaching 20 or 150....


4

Replying to Majenko's answer with more depth. The limits of the Arduino hardware depend on the ATmega CPU it's built around (I suspect you'll be directly migrating from Arduino to the final PCB). but I'm not sure if the platform is stable enough to use it for something >like this. Thus it may be worth considering for you to read through the data sheet. ...


4

Just a small mistake! Not much big of a deal :D In the move function void move(int from, int to) { // initiate the move to the new angle servoMain.write(to); // wait for the movement to actually happen over the actual angle to move through delay(1000 * speed * int(from-to)); } suppose the values passed are 20, 35 then the last line would be 1000*...


4

The simple thing would be for your sketch to read from the serial port continuously. If it finds something it stores it and when a newline arrives it sees if that happens to be a password known only to you. So, for example, all you would have to do is plug in the USB cable, activate the Serial Monitor on your PC, type swordfish and the servo opens the box. ...


4

1) You should be using: myservo.write(pos); instead of servo.write(pos); for all of your methods. 2) Change: include #include<Servo.h> to #include <Servo.h> This code only verifies when it is run on certain boards*, so make sure you are using one of those boards.Good luck and welcome to the Arduino world!:) *Verify that your board ...


4

!flip doesn't really do anything and will probably be optimized out by the compiler. You need to save the result: flip = !flip; You can simplify the code a bit: void loop() { if(flip) { servo.write(60); } else { servo.write(100); } flip = !flip; delay(650); } Or, get rid of the delay altogether: uint32_t ...


4

You cannot. You will need an Arduino at the servo end to generate the PWM signal from serial instructions sent over Bluetooth. Since PWM is (typically) 8-bit and serial is (typically) 8-bit you could simply have each byte as a 1:1 mapping to a PWM value. One the transmit end: bluetoothSerial.write(pwmValue); On the receive end: if (bluetoothSerial....


Only top voted, non community-wiki answers of a minimum length are eligible