Технический форум

Технический форум (http://www.tehnari.ru/)
-   Микропроцессоры (http://www.tehnari.ru/f115/)
-   -   Китайский Ардуино uno (http://www.tehnari.ru/f115/t256391/)

eunerka 01.11.2017 21:25

Китайский Ардуино uno
 
Вложений: 2
Умения есть Ардуино Уно с китая. С Помощью него я пробую зделать солнечный трекер. И вот вопрос про питание серво. У китайскова Ардуино заметел что унего есть два 5 В выхода и два заземление . По схеме фото резисторы с резисторами и серво подключены к андаму и таможе 5 В выходу. Но на практике умения каратит весь микро процесар. А если подключить серво к дополнительному питанию 5 В на ардуине, также будет работать?
Цитата:

//The DIY Life
//10 October 2016
//Michael Klements

#include <Servo.h>

Servo tracker; // create servo object to control a servo
int eastLDRPin = 0; //Assign analogue pins
int westLDRPin = 1;
int eastLDR = 0; //Create variables for the east and west sensor values
int westLDR = 0;
int error = 0;
int calibration = 204; //Calibration offset to set error to zero when both sensors receive an equal amount of light
int trackerPos = 90; //Create a variable to store the servo position

void setup()
{
tracker.attach(11); // attaches the servo on pin 11 to the servo object
}


void loop()
{
eastLDR = calibration + analogRead(eastLDRPin); //Read the value of each of the east and west sensors
westLDR = analogRead(westLDRPin);
if(eastLDR<350 && westLDR<350) //Check if both sensors detect very little light, night time
{
while(trackerPos<=160) //Move the tracker all the way back to face east for sunrise
{
trackerPos++;
tracker.write(trackerPos);
delay(100);
}
}
error = eastLDR - westLDR; //Determine the difference between the two sensors.
if(error>15) //If the error is positive and greater than 15 then move the tracker in the east direction
{
if(trackerPos<=160) //Check that the tracker is not at the end of its limit in the east direction
{
trackerPos++;
tracker.write(trackerPos); //Move the tracker to the east
}
}
else if(error<-15) //If the error is negative and less than -15 then move the tracker in the west direction
{
if(trackerPos>20) //Check that the tracker is not at the end of its limit in the west direction
{
trackerPos--;
tracker.write(trackerPos); //Move the tracker to the west
}
}
delay(100);
}

Ultras 02.11.2017 10:25

Похоже, Вашему проекту просто не хватает питания. Я так понимаю - Вы его от компьютера через USB кормите, так попробуйте внешний БП.

И эта... spellchecker какой-нибудь, для проверки орфографии, используйте что ли...

prst 02.11.2017 19:16

Цитата:

Сообщение от Ultras (Сообщение 2529064)
И эта... spellchecker какой-нибудь, для проверки орфографии, используйте что ли...

Человек с "Visaginas, Lithuania", уж могли бы лояльность проявить и промолчать.

uzren 02.11.2017 20:05

По приведенной схеме должно работать. Только вопрос в мощности серво. Если серво "кушает" более 0,9А (по крайней мере на имеющихся у меня платах UNO стоит такой стабилизатор ASM1117 до 0,9А, то питания не хватит. Серву в этом случае нужно питать от отдельного 5-ти вольтового источника.


Часовой пояс GMT +4, время: 17:53.

Powered by vBulletin® Version 4.5.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.