Stepper motor control for antenna rotor

For satellite TV reception in an RV can be an expensive automatic satellite antenna buy or a simple inexpensive satellite antenna on a tripod to affix and manually align. This is usually very time-consuming, and since the antenna is outside, on the inside of the television receiver, however, one can observe the success of doing poorly.

A much more comfortable and still preiwerte solution to the presented antenna Rotor with step motor control. The control of the step motor is of a NodeMCU LUA Amica VS module with ESP8266 12F so that the operation via the Wi-Fi can be. The ESP8266 is operated as an Access Point. With a Smartphone you can control then quite simply, the antenna rotor.

In this mode, the ESP8266 is always the IP-address 192.168.4.1

The proposed program creates a WLAN with the SSID "antenna" and the password "womo12345". Of course, this may be due to Changes in the program changed.

If the antenna Rotor is supplied with current, one can find in a smartphone, in the Wi-Fi list, Wi-Fi with name "antenna". We connect with this wifi and launch a Browser App. As a URL we enter 192.168.4.1.

We should now see the following Homepage in the Browser, and see

If we are on one of the buttons to click should the antenna in the desired direction of turn.

Parts list:

 

 

 

 

/*
 * Copyright (c) 2015, Majenko Technologies
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 * 
 * * Redistribution of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 * 
 * * Redistribution in binary form must reproduce the above copyright notice, this
 * list of conditions and the following disclaimer in the documentation and/or
 * other materials provided with the distribution.
 * 
 * * Neither the name of Majenko Technologies nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/* Create a WiFi access point and provide a web server on it. */

#include <ESP8266WiFi.h>
#include <wifi client.h> 
#include <ESP8266WebServer.h>

/*HTML Code for the Homepage of the controller
 * It is a simple form with a
 input field for the speed, and three buttons on the
 * Right, left and Stop -
 */
const char INDEX_HTML[] =
"<!DOCTYPE HTML>"
"<html>"
"<head>"
"<meta name = \"viewport\" content = \"width = device-width, initial-scale = 1.0, maximum-scale = 1.0, user-scalable=0\">"
"<title>antenna rotor</title>"
"<style>"
"body { background-color: #d2f3eb; font-family: Arial, Helvetica, Sans-Serif; Color: #000000; }"
"input { font-size:16pt; }"
"</style>"
"</head>"
"<body>"
"<h1>antenna rotor</h1>"
"<FORM action=\"/data\" method=\"post\">"
"<P>"
"<INPUT type=\"submit\" name=\"LEFT\" value=\"left\">&nbsp;"
"<INPUT type=\"submit\" name=\"STOP\" value=\"Stop\">&nbsp;"
"<INPUT type=\"submit\" name=\"RIGHT\" value=\"Right\"><br><br>"
"speed (1 - 10):<br>"
"<INPUT type=\"text\" value=\"%i\" name=\"SPEED\">" 
"</P>"
"</FORM>"
"</body>"
"</html>";

//global variables
const char *ssid = "antenna"; //Name of the Wi-Fi, 
const char *password = "womo12345"; //Password for the Wi-Fi,

const int stp = 12; //Pin number for the Step of connecting the Motor driver
const int dir = 13; //Pin number for the direction connection of the Motor driver
int direction = 0; //current direction
int delay = 100; //delay for Motor steps
int spd = 1; /current speed

ESP8266WebServer server(80); //Web Server on Port 80

//This function is called when the Request to the Web Server = "/" is
void handle root,() {   char html[1000];//Buffer for Request   //Send the Homepage to the Browser wherein the speed of the input   //with whichv the current speed preset is   sprintf(html, INDEX_HTML,spd);    server to.send(200, "text/html", in html );
}

//This function is called if the Request "/left" is
void handle left() {   direction, = 1;//direction to links and website for answers   handle root();
}

//This function is called if the Request is "/right" is
void handle right() {   direction = 2; //the direction to the right, and with home answers   handle root();
}

//This function is called if the Request is "/stop" is
void handle stop() {   direction =0; //direction to the stop and with website for answers   handle root();    }

//This function is called if the Request is "/data?..." is
void handle data() {   String sspd;   //Depending on the arguments of the request, direction and   //velocity set. Speed between 1 and 10   if (server.hasArg("LEFT")) direction, = 1;   if (server.hasArg("RIGHT")) direction = 2;   if (server.hasArg("STOP")) in the direction of = 0;   if (server.hasArg("SPEED")) {     sspd = server.arg("SPEED");     spd = sspd.toInt();     if (spd < 1) spd = 1;     if (spd > 10) spd = 10;     dly = (11-spd)*10; //step distance 100 at speed 1                        //and a 10 at speed a 10   }   handle root(); //With the website for answers
}

void setup() {   //Pins to prepare   pinMode(stp, OUTPUT);   pinMode(dir, OUTPUT);   digitalWrite(stp,HIGH);   digitalWrite(you,HIGH);   delay(1000);   Serial.begin(115200);   Serial.. println();   to Serial.print("Configuring the access point...");      WiFi.softAP(ssid, password);   IPAddress myIP = WiFi.softAPIP();   Serial.print("AP IP address: ");   Serial.println(myIP);   //ip is always 192.168.4.1   //Definition of the response functions of   the server.on("/", handle root);   server.on("/left",, handle left);   the server.on("/right",, handle right);   server.on("/stop", handle to stop);   the server.on("/data", handle data);   //Web Server start   server to.begin();   Serial.println("HTTP server started");
}

//main loop
void loop() {   //To Request check   server.handle the client();   //according to the direction of the direction Pin   //and a step on the Step Pin output    //step length in ms is by dly determines   if (the direction of == 1) {     Serial.println("left");     digitalWrite(you,LOW);     digitalWrite(stp,LOW);     delay(dly);     digitalWrite(stp,HIGH);     delay(dly);   }   if (the direction of == 2) {     Serial.println("right");     digitalWrite(you,HIGH);     digitalWrite(stp,LOW);     delay(dly);     digitalWrite(stp,HIGH);     delay(dly);   }
}

Esp-8266Projekte für fortgeschrittene

2 comments

Jörg Mehring

Jörg Mehring

Hallo,
die Stromversorgung könnte man vielleicht der Phantomspeisung des LNBs entnehmen, da die Polarisation über eine Schaltspannung von 14 bis 18 Volt eingestellt wird. Je nach Strombedarf der o.g. Schaltung sollte das gehen.

Frank Jetzschmann

Frank Jetzschmann

Hallo,
bei Verwendung von (größeren) Schrittmotoren ist zwingend ein (mindestens) 100µF Elko direkt an der Schrittmotorsteuerplatine (+12V Anschluss) notwendig. Sonst wird die Schrittmotorsteuerplatine zerstört. Hinweise zu diesem Phänomen finden sich in diversen Applikationsschaltungen im Internet.

Sonst eine wirklich clevere Lösung mit Potential für eigene Verbesserungen :-)

Leave a comment

All comments are moderated before being published