DIY Arduino C-Band Dish Mover

Dish_Control.ino
C++:
#include <UTFT.h>
#include <UTouch.h>
#include <EEPROM.h>

#define PULSEIN A0
#define WEST 2
#define WESTRELAY 3
#define EAST 4
#define EASTRELAY 5

//EEPROM
#define EE_CURPOS 10
#define EE_EASTLIMIT  100
#define EE_WESTLIMIT  200

// Declare fonts used
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t UbuntuBold[]; //24x32
extern uint8_t SevenSegNumFont[];
extern uint8_t various_symbols[];
extern uint8_t SixteenSegment16x24[];
extern uint8_t SixteenSegment32x48[];
extern uint8_t SixteenSegment40x60[];
extern uint8_t SixteenSegment128x192Num[];
extern uint8_t Grotesk16x32[];
extern uint8_t GroteskBold32x64[];
extern uint8_t DotMatrix_M_Slash[];//16x22
extern uint8_t DotMatrix_XL_Num[];//32x50
extern uint8_t battery_24x48[];
extern uint8_t ArialNumFontPlus[];//32x50 Num and : only
extern uint8_t swiss721_outline[];//16x16
extern uint8_t Arial_round_16x24[];
extern uint8_t Inconsola[]; //24x32
//extern uint8_t tmp_agfx2[]; //64x128
extern uint8_t SixteenSegment64x96Num[];
extern uint8_t SevenSegment96x144Num[];
extern uint8_t Calibri32x64GR[];

// Set the pins to the correct ones for your development shield
// ------------------------------------------------------------
// Standard Arduino Mega/Due shield            : <display model>,38,39,40,41

// Remember to change the model parameter to suit your display module!
UTFT TFT(SSD1963_800480, 38, 39, 40, 41); //(byte model, int RS, int WR, int CS, int RST, int SER)

UTouch  TOUCH( 43, 42, 44, 45, 46);  //byte tclk, byte tcs, byte din, byte dout, byte irq


char Version[] = "FIRMWARE 0.0.94";
char VDate[] = "March 02, 2020";

int pos = 0;                  //Current Position
int prePos = 0;               //Previous Position
bool posPulseReady = 1;       //Positive Pulse or reed switch closure
bool zeroPulseReady = 0;      //Zero pulse or reed switch open

int eastLimit = 0;
int westLimit = 0;

bool errorClearOK = 0;
bool posError = 0;
static bool getTimeOK = 1;
static unsigned long startTime = 0;
static unsigned long currentTime = 0;

bool eastBlock = 0;
bool westBlock = 0;

//==============================
//========Touch=================
bool westTouch = 0;
bool westTActive = 0;
bool eastTouch = 0;
bool eastTActive = 0;




void setup()
{
  pinMode(PULSEIN, INPUT);
  pinMode(WEST, INPUT);
  pinMode(EAST, INPUT);
  pinMode(WESTRELAY, OUTPUT);
  pinMode(EASTRELAY, OUTPUT);

  // Setup the LCD
  TFT.InitLCD();
  // -------------------------------------------------------------
  pinMode(8, OUTPUT);  //backlight
  digitalWrite(8, HIGH);//on
  // -------------------------------------------------------------

  TFT.setFont(BigFont);
  TFT.clrScr();

  //----------------------TOUCH---------------
  TOUCH.InitTouch();
  TOUCH.setPrecision(PREC_MEDIUM);
  //------------------------------------------

 
  TFT.setColor(255, 255, 255);
  TFT.fillRect(0, 0, 799, 16);
  TFT.setColor(0, 0, 255);
  TFT.fillRect(0, 466, 799, 479);
  TFT.setColor(255, 255, 255);
  TFT.setBackColor(255, 0, 0);
  TFT.print("* KE4EST 01.15.2020 *", CENTER, 1);
  TFT.setBackColor(64, 64, 64);
  TFT.setColor(255, 255, 0);
  TFT.print("Dish Mover Beta", CENTER, 465);

  //  TFT.setColor(0, 0, 255);
  //  TFT.drawRect(0, 14, 799, 465);
  TFT.setBackColor(0, 0, 0);
  TFT.setFont(Calibri32x64GR);
  TFT.setColor(255, 255, 255); //WHITE

  Serial.begin(115200);
  TFT.setFont(UbuntuBold);
  TFT.printNumI(pos, 320, 100);

  //EEPROM================
  pos = EEPROM.read(EE_CURPOS);
  eastLimit = EEPROM.read(EE_EASTLIMIT);
  westLimit = EEPROM.read(EE_WESTLIMIT);
  
  Setup();
  DrawButtons();

}

void loop()
{
  CurrentPosition(); //Display current position number if changed

  //=====================================================
  //===== GET TOUCH INPUT================================

  ScanForTouchWest();
  ScanForTouchEast();
  ScanForTouchMenu();

  //=====================================================


  //======================WEST===========================
  if (!westBlock)
  {
    if (West() || westTouch)
    {
      eastBlock = 1;
      WestActive();
    }
    else  //else west button not depressed
    {
      eastBlock = 0;
      WestNotActive();
    }
  }
  //======================EAST========================
  if (!eastBlock)
  {
    if (East() || eastTouch)
    {
      westBlock = 1;
      EastActive();
    }
    else  //else west button not depressed
    {
      westBlock = 0;
      EastNotActive();
    }
  }
}

bool Pulse()
{
  bool pulse = digitalRead(PULSEIN);
  return pulse;
}

bool West()
{
  bool west = digitalRead(WEST);
  return west;
}

bool East()
{
  bool east = digitalRead(EAST);
  return east;
}

unsigned long PulseErrorCheck()
{
  if (getTimeOK)
  {
    startTime = millis();
    getTimeOK = 0;
  }
  currentTime = (millis() - startTime);
  return currentTime;
}

void CurrentPosition()
{
  int posPrint = 0;
  if (pos != prePos)
  {
    if (pos < 0)
    {
      posPrint = pos * -1;
      TFT.print("-", 295, 100);
    }
    else
    {
      posPrint = pos;
      TFT.print(" ", 295, 100);
    }
    if (posPrint >= 0 && posPrint < 10)
    {
      TFT.printNumI(posPrint, 320, 100);
      TFT.setColor(0, 0, 0);
      TFT.fillRect(343, 100, 415, 130);
      TFT.setColor(255, 255, 255);
    }
    else if (posPrint >= 10 && posPrint < 100)
    {
      TFT.printNumI(posPrint, 320, 100);
      TFT.setColor(0, 0, 0);
      TFT.fillRect(367, 100, 415, 130);
      TFT.setColor(255, 255, 255);
    }
    else if (posPrint >= 100 && posPrint < 1000)
    {
      TFT.printNumI(posPrint, 320, 100);
      TFT.setColor(0, 0, 0);
      TFT.fillRect(391, 100, 415, 130);
      TFT.setColor(255, 255, 255);
    }
    else if (posPrint >= 1000 && posPrint < 10000)
    {
      TFT.printNumI(posPrint, 320, 100);
      //      TFT.setColor(0, 255, 255);
      //      TFT.fillRect(432, 100, 468, 130);
      TFT.setColor(255, 255, 255);
    }
    else if (posPrint >= 10 && posPrint < 100)
    {
      TFT.printNumI(posPrint, 320, 100);
      TFT.setColor(0, 0, 0);
      TFT.fillRect(367, 100, 415, 130);
      TFT.setColor(255, 255, 255);
    }
    else
    {
      TFT.printNumI(posPrint, 320, 100);
      //TFT.setColor(0, 0, 0);
      // TFT.fillRect(368, 140, 468, 170);
      TFT.setColor(255, 255, 255);
    }
    Serial.println(pos);
    prePos = pos;
  }
}
 
Last edited:
  • Like
Reactions: Brct203
Buttons.ino
C++:
void DrawButtons()
{
//Draw Button for Menu===================================
  //Outer rectangle
  TFT.setColor(255, 255, 255);
  TFT.drawRoundRect(320, 400, 480, 460);
  //inner rectangle
  TFT.setColor(0, 0, 255);
  TFT.drawRoundRect(322, 402, 478, 458);
  //background color of button
  TFT.setColor(255, 255, 255);
  TFT.fillRoundRect(324, 404, 476, 456);
  //Text for West
  TFT.setColor(0, 0, 255);
  TFT.setBackColor(255, 255, 255);
  //TFT.setFont(BigFont);

  TFT.print("MENU", 355, 415);
  TFT.setBackColor(0, 0, 0);
}

East.ino
C++:
void EastActive()
{
  if (!posError)
  {
    digitalWrite(EASTRELAY, 1);
    TFT.setColor(0, 255, 0);
    TFT.fillCircle(768, 160, 12);
    TFT.setColor(0, 255, 0);
    TFT.print("EAST", 700, 100);
    TFT.setColor(255, 255, 255);
    errorClearOK = 1;
  }
  if (PulseErrorCheck() >= 1000)
  {
    TFT.setColor(255, 255, 255);
    TFT.print("EAST ERROR", CENTER, 315);
    digitalWrite(EASTRELAY, 0);
    TFT.setColor(255, 0, 0);
    TFT.fillCircle(768, 160, 12);
    TFT.setColor(255, 255, 255);
    posError = 1;
  }
  if (Pulse())
  {
    if (posPulseReady)
    {
      pos--;
      posPulseReady = 0;
      zeroPulseReady = 1;
      getTimeOK = 1;
    }
  }
  else
  {
    if (zeroPulseReady)
    {

      posPulseReady = 1;
      zeroPulseReady = 0;
    }
  }
}

void EastNotActive()
{
  TFT.print("    ", 700, 100); //clear the word EAST off of right hand of screen
  getTimeOK = 1;
  posError = 0;
  if (errorClearOK)
  {
    TFT.print("          ", CENTER, 315); //Clear ERROR if exists
    errorClearOK = 0;
    digitalWrite(EASTRELAY, 0);
    TFT.setColor(0, 0, 0);
    TFT.fillCircle(768, 160, 12);
    TFT.setColor(255, 255, 255);
  }
}

West.ino
Code:
void WestActive()
{
  if (!posError)
  {
    digitalWrite(WESTRELAY, 1);
    TFT.setColor(0, 255, 0);
    TFT.fillCircle(20, 160, 12);
    TFT.setColor(0, 255, 0);
    TFT.print("WEST", 0, 100);
    TFT.setColor(255, 255, 255);
    errorClearOK = 1;
  }
  if (PulseErrorCheck() >= 1000)
  {
    TFT.setColor(255, 255, 255);
    TFT.print("WEST ERROR", CENTER, 315);
    digitalWrite(WESTRELAY, 0);
    TFT.setColor(255, 0, 0);
    TFT.fillCircle(20, 160, 12);
    TFT.setColor(255, 255, 255);
    posError = 1;
  }
  if (Pulse())
  {
    if (posPulseReady)
    {
      pos++;
      posPulseReady = 0;
      zeroPulseReady = 1;
      getTimeOK = 1;
    }
  }
  else
  {
    if (zeroPulseReady)
    {

      posPulseReady = 1;
      zeroPulseReady = 0;
    }
  }
}

void WestNotActive()
{
  TFT.print("    ", 0, 100); //clear the word WEST off of left hand of screen
  getTimeOK = 1;
  posError = 0;
  if (errorClearOK)
  {
    TFT.print("          ", CENTER, 315);
    errorClearOK = 0;
    digitalWrite(WESTRELAY, 0);
    TFT.setColor(0, 0, 0);
    TFT.fillCircle(20, 160, 12);
    TFT.setColor(255, 255, 255);
  }
}
 
Initialize.ino
C++:
void Setup()
{

  //Draw Button for West===================================
  //Outer rectangle
  TFT.setColor(255, 255, 255);
  TFT.drawRoundRect(40, 300, 200, 360);
  //inner rectangle
  TFT.setColor(0, 0, 255);
  TFT.drawRoundRect(42, 302, 198, 358);
  //background color of button
  TFT.setColor(255, 255, 255);
  TFT.fillRoundRect(44, 304, 196, 356);
  //Text for West
  TFT.setColor(0, 0, 255);
  TFT.setBackColor(255, 255, 255);
  //TFT.setFont(BigFont);

  TFT.print("WEST", 70, 315);
  TFT.setBackColor(0, 0, 0);

  //Draw Button for East===================================
  //Outer rectangle
  TFT.setColor(255, 255, 255);
  TFT.drawRoundRect(601, 300, 759, 360);
  //inner rectangle
  TFT.setColor(0, 0, 255);
  TFT.drawRoundRect(603, 302, 757, 358);
  //background color of button
  TFT.setColor(255, 255, 255);
  TFT.fillRoundRect(605, 304, 755, 356);
  //Text for West
  TFT.setColor(0, 0, 255);
  TFT.setBackColor(255, 255, 255);
  //TFT.setFont(BigFont);

  TFT.print("EAST", 635, 315);
  TFT.setBackColor(0, 0, 0);

}

Menu.ino
C++:
void ScanForTouchMenu()
{
 
}

TouchE.ino
C++:
void ScanForTouchEast()
{

 
  int xT, yT;
  if (TOUCH.dataAvailable())
  {
    TOUCH.read();
    xT = TOUCH.getX();
    yT = TOUCH.getY();

    if ((yT >= 300) && (yT <= 360))
    {
      if ((xT >= 601) && (xT <= 759))
      {
        eastTActive = 1;
        eastTouch = 1;
        TFT.setColor(0, 0, 0);
        TFT.drawRoundRect(601, 300, 759, 360);
        TFT.setColor(0, 255, 255);
        TFT.drawRoundRect(603, 302, 757, 358);
        //        TFT.setColor(255, 255, 255);
        //        TFT.print("West Touched    ", CENTER, 200);
      }
    }
  }
  else
  {
    eastTouch = 0;
    TFT.setColor(255, 255, 255);
    TFT.drawRoundRect(601, 300, 759, 360);
    TFT.setColor(0, 0, 255);
    TFT.drawRoundRect(603, 302, 757, 358);
    eastTActive = 0;
  }
}

TouchW.ino
C++:
void ScanForTouchWest()
{


  int xT, yT;
  if (TOUCH.dataAvailable())
  {
    TOUCH.read();
    xT = TOUCH.getX();
    yT = TOUCH.getY();

    if ((yT >= 300) && (yT <= 360))
    {
      if ((xT >= 40) && (xT <= 200))
      {
        westTActive = 1;
        westTouch = 1;
        TFT.setColor(0, 0, 0);
        TFT.drawRoundRect(40, 300, 200, 360);
        TFT.setColor(0, 255, 255);
        TFT.drawRoundRect(42, 302, 198, 358);
        //        TFT.setColor(255, 255, 255);
        //        TFT.print("West Touched    ", CENTER, 200);
      }
    }
  }
  else
  {
    westTouch = 0;
    TFT.setColor(255, 255, 255);
    TFT.drawRoundRect(40, 300, 200, 360);
    TFT.setColor(0, 0, 255);
    TFT.drawRoundRect(42, 302, 198, 358);
    westTActive = 0;
  }
}
 
Here is the code attached as a zip file. :) I will post a video going over the code in the morning. I will also open this thread up for discussion. :)
Watch my channel early in the morning for the next video: Michael Graves
 

Attachments

Okay guys discussion is open.
 
I haven't reviewed all the material yet, but there was one thing I was curious about. Are touch screens made with a common interface like LCD displays. Last year I bought a weather sensor with two touch screen displays. Both of these displays failed. They won't boot up. They show the boot screen and freeze. I'm thinking the screens still work and I might be able to repurpose them for this project. They are a larger 7" screen though.

OK a little research and I see what's up. ;) nevermind
 
Last edited:
  • Like
Reactions: KE4EST
There are a ton of different interfaces and different touch chip-sets also. I have a nice screen that I can use as a screen just fine, but not the touch part. No one has wrote any C code library for it. At least not to work with my setup. Lots of projects though, that I don't need touch. :)
 
Could I try to revive this thread? I've been brainstorming so much my head hurts.
Since Brian discontinued the ASC-1 dish movers are sparse out there.
Ones which accept a DISEqC go-to message from a receiver.
I've contacted NXP for info. implementing one of their dev. boards to make a mover using an H Bridge.
Software licensing is not cheap. And with my limited programming knowledge plus the learning curve to expand on it.
Time would run out. Contacted a few others also.

I see a closed thread here that pertained to troubles getting a reliable clean data stream.
I found quite a few circuits to pull, filter the 22 kHz frequency, and provide a clean pulse train out.
I actually built a crude filter and comparator and fed it into my DSO and was able to "kind of" decode and pick out the go-to code. It was made from parts I had laying around and stuffed in a breadboard.

Follow me? My Arduino usage is honestly to use the serial port and console to flash firmware and debug things like routers and such. I've just tippy-toed into the programming.
How to wait for and store a DISEqC data stream. Read the data stream. Find the go-to memory location. BUILD the memory and store encoder count position locations. And command the H Bridge to send the dish to the right place.
Step by step. Right? And somehow stuff in a display, maybe read a remote control.
Overwhelming.

As I do my daily search on eBay I see a lot of the commercial dish movers such and those made by Research Concepts. But they are keyboard entry. Big and robust and made to last. Affordable on some days.
But. They do not accept a DISEqC signal.
They do have a RS-422 interface and a manual with console commands.
Other dish movers I see have dedicated software that communicates over a data bus.
They all have stored positions in NVRAM. The all have a go-to command.
No DISEqC interfaces.

I need a translator. A protocol converter.
An Arduino or Raspberry pi that just sits there waiting for a data stream from my receiver.
Store the message in a buffer. Read the buffer. Pick out the go-to command data.
And send a compatible data stream out to the RS-422 interface on the dish mover.

Such a thing must exist. Perhaps not for satellite dish "language". But adaptable?
Does this sound immediately like a far fetched idea?
Is/has something like this been done with an Arduino or pi?
 
  • Like
Reactions: Brct203 and FTA4PA
This might be of some help.

 
  • Like
Reactions: Brct203 and FTA4PA
Top