Yet another request... large touchscreen interactive video

Hi all

I do free work for a local charity that teach young kids about various things.
They have asked me for a large touchscreen (think 50"+) with an image on it.

When you touch the screen in certain places, it will change the video image but also output to a relay.
It also need to read a set of dry contacts to change the video image.

Hmm..... that's a tricky one.

My thought is obviously this is way outside an Arduino, so maybe a small Windows PC with attached touchscreen. That way in theory, I have some kind of possible access to the touchscreen.

Just need to find software that will make any of that work!

Just wondering, wouldn't Raspberry Pi be a better fit here ? Already has touch screen support along with some digital I/O's that you can use

What do you mean? You are to locate and purchase this yourself? AFAIK, such a screen is something you'd buy if it exists. I wouldn't know how to approach building a 50"+ touchscreen.

Would clicking on the screen with a mouse in certain places do the trick? That's doable with Arduino and Processing.

EDIT: here's two sketches: one for Arduino that uses only a pushbutton (no resistors needed) and shows output on the built in LED. That digital signal is all you need to switch a relay using an appropriate relay module.
The second sketch is a Processing sketch (Processing 4 specifically). It links to the serial port the Arduino is connected to (as long as the COM number isn't > 26, it shouldn't be) and uses the PC keyboard arrow keys to communicate with the Arduino and also listens for the Arduino to change the background color of your monitor.

It's just a simple demo to show how Arduino and Processing can interact, if you don't know.

1: Arduino

String lastString;
int led = LED_BUILTIN;
const int button = 2;

int buttonPushCounter = 0;
int buttonState = 1;
int lastButtonState = 1;

void setup() {
  Serial.begin(115200);
  pinMode(button, INPUT_PULLUP);// reverses button logic, no external resistors required
  pinMode(led, OUTPUT);
  digitalWrite(led, LOW);
}

void loop() {
  if (Serial.available() > 0) {
    char in = Serial.read();
    if ((in == 'h') || (in == 'H')) {
      digitalWrite(led, HIGH);
    } else if ((in == 'l') || (in == 'L')) {
      digitalWrite(led, LOW);
    }
  }
  buttonState = digitalRead(button);
  // compare the buttonState to its previous state
  if (buttonState != lastButtonState) {
    // if the state has changed, increment the counter
    if (buttonState == LOW) {
      // if the current state is LOW then the button went from off to on
      buttonPushCounter++;
      if (buttonPushCounter % 2 == 0) {
        Serial.println("green");
      } else {
        Serial.println("red");
      }
      delay(500);
    }
  }
  lastButtonState = buttonState;
}

  1. Processing:
import processing.serial.*;
Serial myPort;
int rval, gval, bval;
int state;

String[] com = {"COM2", "COM3", "COM4",
  "COM5", "COM6", "COM7", "COM8", "COM9", "COM10", "COM11",
  "COM12", "COM13", "COM14", "COM15", "COM16", "COM17", "COM18",
  "COM19", "COM20", "COM21", "COM22", "COM23", "COM24", "COM25", "COM26"};

void settings() {
  fullScreen(P3D);
}

void setup() {
  background(0, 59, 0);
  noStroke();
  fill(204);
  connect(1, 24, 200);
}

void draw() {
  background(rval, gval, bval);
  switch(state) {
  case 0:
    rval = 128;
    gval = 128;
    bval = 128;
    break;
  case 1:
    rval = 0;
    gval = 255;
    bval = 0;
    break;
  case 2:
    rval = 255;
    gval = 0;
    bval = 0;
    break;
  case 3:
    rval = 255;
    gval = 165;
    bval = 0;
    myPort.write('H');
    break;
  case 4:
    rval = 0;
    gval = 60;
    bval = 0;
    myPort.write('L');
    break;
  case 5:
    rval = 0;
    gval = 255;
    bval = 0;
    myPort.write('h');
    break;
  case 6:
    rval = 0;
    gval = 0;
    bval = 255;
    myPort.write('l');
    break;
  default:
    rval = 128;
    gval = 128;
    bval = 128;
    break;
  }
  // use arrow keys to do stuff
  checkDirections();
}


void checkDirections() {
  if (keyPressed) {
    if (keyCode == UP) {
      state = 3;
    } else if (keyCode == DOWN) {
      state = 4;
    } else if (keyCode == LEFT) {
      state = 5;
    } else if (keyCode == RIGHT) {
      state = 6;
    }
    delay(160);
  }
}
// serial seek and connect handler
boolean connect(int portNumber, int numCom, int limit) {
  background (0, 14, 255);
  int tries = 0;
  while (tries < limit) {
    try {
      printArray (Serial.list()[portNumber]);
      myPort = new Serial(this, com[numCom], 115200);
    }
    catch(Exception e) {
      System.err.println("Retrying " + "Port " + com[numCom] + " on Port Number " + portNumber);
      numCom += 1;
      tries++;
      if (numCom < 0) {
        numCom = 24;
      } else if (numCom > 24) {
        numCom = 0;
      }
      if (tries % 25 == 0) {
        portNumber += 1;
        if (portNumber > 4) {
          portNumber = 0;
        }
      }
      delay(200);
      continue;
    }
    break;
  }
  if (tries < limit) {
    println("Connected in " + str(tries + 1) + " tries.");
    background(0, 255, 0);
    delay(200);
    background(0);
    return true;
  } else {
    System.err.println("Connection failed.");
    return false;
  }
}
void serialEvent (Serial myPort) {
  String inString = myPort.readStringUntil('\n');
  if (inString != null) {
    inString = trim(inString);
    if (inString.equals("green")) {
      state = 1;
    } else if (inString.equals("red")) {
      state = 2;
    }
  }
}

It's an interactive screen for very small kids. To teach them basically... not to do stupid things.
I am doing it for free (its all charity), so I don't want to get too mad and deep into this.

But... they do have a sponsor for the equipment, so that isn't an issue.

You can get commercial touchscreens up to 84" that run on Windows, Android etc.
Therefore, yes, they could run on a Raspberry Pi.

Only trouble is... my Pi programming is rusty at best. I could probably get there, but it would be a lot of brain bashing.

But, for managing to interact between the screen, the touchscreen and inputs/outputs.... i't likely to be my best option.

I do know I have some code somewhere from an old project that controls relays via an Uno (Pi to Uno). Can't remember why the PI didn't do it directly, but hey ho.

My only thought would be resolution on a big screen. I assume the higher end PI's are 4k?

Looks like some further research is required. First off, I would need a screen that had the touch element broken out into a USB...

I also could use a Teensy to control the touchscreen/HID.

I need to plan this out

Don't make this harder on yourself than it needs to be. A touchscreen that size is already going to set them back $1,500+ Amazon.com

So use something like an Intel NUC mini-PC running Windows and get it done quickly. If you need to read digital inputs, attach an arduino to a USB port and transfer the data through it.

1 Like

I had a tutorial on this but my internet service provider pulled the plug on the free web space they offered and took my whole site off line and didn't even offer a web redirection service. Tech support says every time they suggest this the CEO of the company says it will cost hundreds of thousand pounds to implement.
This file
The_sound_squarw.zip

When un-compressed you can double click the .HTML file and it should load just that page into your default browser. Let me know if you have any problems with this. Of course none of the links off this page will work.

It was a project that started in 1994 as a touch screen for a BBC Micro monitor touch screen. The idea is that the IR emitters and receivers are constantly scanning and then you touch the screen you get an indication of where you touched. It helps if youn put a square on each sensor intersection.

This is the original text and diagrams:-

TouchScreen.txt (9.3 KB)
BBC137D.TIFF.zip (38.5 KB)

1 Like

Ok I'm along for the ride. How does this interact with touchscreen? I respect you, I'm genuinely asking.

A "non-profit" wants four-year-olds to smack a $1500 touchscreen to teach them not to do stupid stuff? Nope.

4 Likes

Check the screen to make sure, but most touchscreens use HDMI for output and provide touch input via USB. The USB input looks like a mouse to the PC.

Also, to keep the cost down, you used to be able to buy overlays that go on a regular screen and provide the touch input. I don't know how common they still are though.

FWIW, if you're a PC developer, .NET will run on a pi and it's trivial to spool up a Razor page and host it locally.

Interesting, cheers.

Thanks all.
I found a nice 42" touchscreen with the touch output on USB with vandalproof glass for under 1k. At the end of the day, the charity get companies to pay for this stuff... so I just need to source it.

I have a spare 42" TV here (without touch), so I will get a system together on that just using a mouse, and when I am happy, they can get the posh touchscreen.

I'll try all the options above
Thank you

1 Like