SER0044 Analog Feedback Noise
![userHead](https://dfimg.dfrobot.com/dfPortrait2.png)
Product: SER0044
IDE: Arduino 1.8.10
Issue: When reading the analog feedback from the servo while it is running, there is a lot of noise
Code snippit:
When I attempt to read the analog values while the motor is NOT running, I get a smooth gradient of numbers, with no jumping around of numbers.
Do I have a faulty unit or is this product simply this bad....
IDE: Arduino 1.8.10
Issue: When reading the analog feedback from the servo while it is running, there is a lot of noise
Code snippit:
Code: Select all
Sample of sweeping motion capture:
#include <Servo.h>
Servo myservo;
int pos = 90;
uint16_t val;
double dat;
void setup()
{
Serial.begin(9600);//Set Baud Rate to 9600 bps
myservo.attach(9);
myservo.write(160);
}
void loop()
{
for(pos = 20; pos <= 160; pos += 1)
{
myservo.write(pos);
readPot();
delay(15);
}
for(pos = 160; pos >= 20; pos -= 1)
{
myservo.write(pos);
readPot();
delay(15);
}
}
void readPot()
{
val=analogRead(A5);//Connect Analog pin to A0
dat = (double) (val - 68) * .5075;
Serial.print("Position:");
Serial.print(dat);
Serial.print(" Analog Value: ");
Serial.println(val);
}
Code: Select all
As you can see, the readings jump around a lot even though it is a smooth sweeping motion.Position:58.36 Analog Value: 183
Position:52.78 Analog Value: 172
Position:50.75 Analog Value: 168
Position:45.68 Analog Value: 158
Position:50.75 Analog Value: 168
Position:54.30 Analog Value: 175
Position:59.88 Analog Value: 186
Position:55.83 Analog Value: 178
Position:63.44 Analog Value: 193
Position:65.97 Analog Value: 198
Position:59.88 Analog Value: 186
Position:68.51 Analog Value: 203
Position:65.97 Analog Value: 198
Position:73.59 Analog Value: 213
Position:74.60 Analog Value: 215
Position:66.99 Analog Value: 200
Position:69.02 Analog Value: 204
Position:70.03 Analog Value: 206
Position:74.60 Analog Value: 215
Position:82.72 Analog Value: 231
Position:74.60 Analog Value: 215
Position:76.63 Analog Value: 219
Position:77.14 Analog Value: 220
Position:79.17 Analog Value: 224
Position:80.69 Analog Value: 227
Position:82.21 Analog Value: 230
Position:86.78 Analog Value: 239
Position:88.81 Analog Value: 243
Position:90.84 Analog Value: 247
Position:87.80 Analog Value: 241
Position:87.29 Analog Value: 240
Position:90.33 Analog Value: 246
Position:92.36 Analog Value: 250
Position:97.95 Analog Value: 261
Position:100.99 Analog Value: 267
Position:95.41 Analog Value: 256
Position:98.45 Analog Value: 262
Position:99.47 Analog Value: 264
Position:102.51 Analog Value: 270
Position:114.69 Analog Value: 294
Position:104.04 Analog Value: 273
Position:105.56 Analog Value: 276
Position:109.11 Analog Value: 283
Position:113.17 Analog Value: 291
Position:111.14 Analog Value: 287
Position:112.66 Analog Value: 290
Position:117.74 Analog Value: 300
Position:120.28 Analog Value: 305
Position:117.23 Analog Value: 299
Position:118.25 Analog Value: 301
Position:119.77 Analog Value: 304
Position:124.84 Analog Value: 314
Position:123.32 Analog Value: 311
Position:124.34 Analog Value: 313
Position:126.87 Analog Value: 318
Position:131.44 Analog Value: 327
Position:129.41 Analog Value: 323
Position:129.92 Analog Value: 324
Position:139.05 Analog Value: 342
Position:133.98 Analog Value: 332
Position:136.01 Analog Value: 336
Position:142.61 Analog Value: 349
Position:139.56 Analog Value: 343
Position:140.07 Analog Value: 344
Position:141.08 Analog Value: 346
Position:147.18 Analog Value: 358
Position:144.64 Analog Value: 353
Position:145.15 Analog Value: 354
Position:154.28 Analog Value: 372
Position:157.33 Analog Value: 378
Position:148.19 Analog Value: 360
Position:151.24 Analog Value: 366
Position:159.86 Analog Value: 383
Position:154.79 Analog Value: 373
Position:155.30 Analog Value: 374
Position:157.83 Analog Value: 379
Position:159.36 Analog Value: 382
Position:173.06 Analog Value: 409
Position:160.88 Analog Value: 385
Position:167.47 Analog Value: 398
Position:164.94 Analog Value: 393
Position:167.47 Analog Value: 398
Position:173.57 Analog Value: 410
Position:169.00 Analog Value: 401
Position:177.12 Analog Value: 417
Position:171.54 Analog Value: 406
Position:172.55 Analog Value: 408
Position:181.69 Analog Value: 426
Position:178.64 Analog Value: 420
Position:177.63 Analog Value: 418
Position:186.76 Analog Value: 436
Position:181.18 Analog Value: 425
Position:185.75 Analog Value: 434
Position:185.75 Analog Value: 434
Position:185.24 Analog Value: 433
Position:192.34 Analog Value: 447
Position:190.82 Analog Value: 444
Position:190.82 Analog Value: 444
Position:195.90 Analog Value: 454
Position:196.40 Analog Value: 455
Position:196.91 Analog Value: 456
Position:193.86 Analog Value: 450
Position:204.52 Analog Value: 471
Position:200.97 Analog Value: 464
Position:200.97 Analog Value: 464
Position:210.11 Analog Value: 482
Position:204.52 Analog Value: 471
Position:205.54 Analog Value: 473
Position:203.00 Analog Value: 468
Position:215.69 Analog Value: 493
Position:210.61 Analog Value: 483
Position:212.13 Analog Value: 486
Position:214.16 Analog Value: 490
Position:220.25 Analog Value: 502
Position:217.72 Analog Value: 497
Position:217.72 Analog Value: 497
Position:222.79 Analog Value: 507
Position:220.76 Analog Value: 503
Position:231.42 Analog Value: 524
Position:227.87 Analog Value: 517
Position:224.82 Analog Value: 511
Position:227.36 Analog Value: 516
Position:228.38 Analog Value: 518
Position:229.39 Analog Value: 520
Position:240.55 Analog Value: 542
Position:234.47 Analog Value: 530
Position:234.97 Analog Value: 531
Position:246.64 Analog Value: 554
Position:237.00 Analog Value: 535
Position:243.60 Analog Value: 548
Position:240.55 Analog Value: 542
Position:241.06 Analog Value: 543
Position:239.54 Analog Value: 540
Position:249.69 Analog Value: 560
Position:238.52 Analog Value: 538
Position:244.61 Analog Value: 550
Position:236.50 Analog Value: 534
Position:237.51 Analog Value: 536
Position:231.93 Analog Value: 525
Position:237.51 Analog Value: 536
Position:228.88 Analog Value: 519
Position:235.48 Analog Value: 532
Position:225.84 Analog Value: 513
Position:223.30 Analog Value: 508
Position:228.38 Analog Value: 518
Position:222.29 Analog Value: 506
Position:221.27 Analog Value: 504
Position:219.24 Analog Value: 500
Position:217.72 Analog Value: 497
Position:215.18 Analog Value: 492
Position:213.15 Analog Value: 488
Position:228.88 Analog Value: 519
Position:210.61 Analog Value: 483
Position:209.60 Analog Value: 481
Position:214.67 Analog Value: 491
Position:206.55 Analog Value: 475
Position:207.06 Analog Value: 476
Position:205.03 Analog Value: 472
Position:201.99 Analog Value: 466
Position:206.55 Analog Value: 475
Position:199.96 Analog Value: 462
Position:197.93 Analog Value: 458
Position:202.49 Analog Value: 467
Position:192.85 Analog Value: 448
Position:193.36 Analog Value: 449
Position:191.83 Analog Value: 446
Position:189.80 Analog Value: 442
Position:195.39 Analog Value: 453
Position:188.28 Analog Value: 439
Position:188.28 Analog Value: 439
Position:191.33 Analog Value: 445
Position:182.19 Analog Value: 427
Position:181.69 Analog Value: 426
Position:185.75 Analog Value: 434
Position:178.13 Analog Value: 419
Position:177.63 Analog Value: 418
Position:180.67 Analog Value: 424
Position:178.13 Analog Value: 419
Position:172.04 Analog Value: 407
Position:172.55 Analog Value: 408
Position:175.60 Analog Value: 414
Position:169.51 Analog Value: 402
Position:164.94 Analog Value: 393
Position:174.58 Analog Value: 412
Position:163.92 Analog Value: 391
Position:162.40 Analog Value: 388
Position:164.43 Analog Value: 392
Position:157.83 Analog Value: 379
Position:156.82 Analog Value: 377
Position:158.34 Analog Value: 380
Position:159.86 Analog Value: 383
Position:153.27 Analog Value: 370
Position:151.24 Analog Value: 366
Position:160.88 Analog Value: 385
Position:156.82 Analog Value: 377
Position:147.18 Analog Value: 358
Position:146.16 Analog Value: 356
Position:144.64 Analog Value: 353
Position:157.33 Analog Value: 378
Position:140.58 Analog Value: 345
Position:138.55 Analog Value: 341
Position:137.53 Analog Value: 339
Position:135.50 Analog Value: 335
Position:139.56 Analog Value: 343
Position:133.47 Analog Value: 331
Position:130.94 Analog Value: 326
Position:131.44 Analog Value: 327
Position:129.41 Analog Value: 323
Position:125.86 Analog Value: 316
Position:125.35 Analog Value: 315
Position:127.89 Analog Value: 320
Position:122.31 Analog Value: 309
Position:122.31 Analog Value: 309
Position:125.86 Analog Value: 316
Position:117.74 Analog Value: 300
Position:124.84 Analog Value: 314
Position:115.20 Analog Value: 295
Position:113.68 Analog Value: 292
Position:115.71 Analog Value: 296
Position:110.63 Analog Value: 286
Position:108.10 Analog Value: 281
Position:107.08 Analog Value: 279
Position:113.17 Analog Value: 291
Position:103.53 Analog Value: 272
Position:99.47 Analog Value: 264
Position:101.50 Analog Value: 268
Position:103.02 Analog Value: 271
Position:97.95 Analog Value: 261
Position:95.41 Analog Value: 256
Position:95.41 Analog Value: 256
Position:93.89 Analog Value: 253
Position:92.36 Analog Value: 250
Position:98.45 Analog Value: 262
Position:102.51 Analog Value: 270
Position:87.29 Analog Value: 240
Position:87.29 Analog Value: 240
Position:85.26 Analog Value: 236
Position:83.23 Analog Value: 232
Position:81.71 Analog Value: 229
Position:81.20 Analog Value: 228
Position:79.17 Analog Value: 224
Position:77.65 Analog Value: 221
Position:75.62 Analog Value: 217
Position:73.59 Analog Value: 213
Position:71.56 Analog Value: 209
Position:71.05 Analog Value: 208
Position:69.02 Analog Value: 204
Position:67.50 Analog Value: 201
Position:64.45 Analog Value: 195
Position:63.44 Analog Value: 193
Position:68.51 Analog Value: 203
Position:60.39 Analog Value: 187
Position:59.38 Analog Value: 185
Position:59.38 Analog Value: 185
Position:58.36 Analog Value: 183
Position:56.33 Analog Value: 179
Position:54.81 Analog Value: 176
Position:52.27 Analog Value: 171
Position:51.26 Analog Value: 169
Position:48.72 Analog Value: 164
Position:48.72 Analog Value: 164
Position:44.66 Analog Value: 156
Position:45.17 Analog Value: 157
Position:43.14 Analog Value: 153
Position:42.63 Analog Value: 152
Position:41.11 Analog Value: 149
Position:39.08 Analog Value: 145
Position:35.02 Analog Value: 137
Position:36.03 Analog Value: 139
When I attempt to read the analog values while the motor is NOT running, I get a smooth gradient of numbers, with no jumping around of numbers.
Do I have a faulty unit or is this product simply this bad....
2020-07-21 23:13:13 I have the 4 servo pins connected to the Arduino 5V, GND, PWM, and Analog In pins, just as is shown on the wiki page.
smellthesmellersmelling
![userHeadPic](https://dfimg.dfrobot.com/dfPortrait2.png)