Author Topic: Custom RGBS and Audio Switch  (Read 8032 times)

0 Members and 1 Guest are viewing this topic.

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Custom RGBS and Audio Switch
« on: June 21, 2021, 09:48:47 am »
I am trying to design a custom rgb video/audio switch. Mainly for Retro video game console connected to a PVM style monitor.
It will also control my monitor via wired remote control for input selection and tally light :D.

Other switcher were considered. Scart in the US seems to be an expensive hassle with many adaptors.  Extrons need custom sync stripping bnc cables that seem difficult to make, both because of the bnc connectors and sync stripping. If this custom switch idea does not work out an Extron is the next choice. Using component and rgb alternating on this monitor involves a switch on the rear of the monitor. Which is mounted in a server rack. This makes component a poor choice.  Most premade cables are on backorder.

I have never built anything like this so any and all help is appreciated.

Chip Selection
I was thinking about this for rgb video https://datasheets.maximintegrated.com/en/ds/MAX4887.pdf

And this for Composite Sync and audio 4751 https://datasheets.maximintegrated.com/en/ds/MAX4751-MAX4753.pdf

Db15 for the inputs using custom cables.
Parts for an example cable.

https://console5.com/store/sony-playstation-1-2-ps1-ps2-av-multi-out-plug-for-custom-rgb-cables-repair.html

https://uk.rs-online.com/web/p/twisted-multipair-industrial-cable/1757358/

https://www.showmecables.com/db15-male-solder-connector-kit-plastic?gclid=CjwKCAjw8cCGBhB6EiwAgORey6VomNB4xNaLKl51ug3MzMZtQSaats0ZCe2rIuD9whPzaKOB4gWTFRoCAAgQAvD_BwE

Mounted in a 2u rack case.

Attached is a prototype design. Made in kicad

Prototype is for three inputs, final will have ten.
Prototype does not have the tv control.
Prototype uses db15 for output. Final will use db15hd for video output and something else for audio output.
Final will have a separate panel for input selection. Possibly an Arduino with a display for input labeling, with a custom design anything is possible.

Questions
Ground and power planes what should they be like?
I know I need some capacitors right?
Am I using vias and planes correctly?
Power circuit? on board ac? external dc?
Are these chips good choices?
Any special note about clearances for the db connctors?
Board layout?
Rca connections in footprints in kicad?

Thanks Again
 

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #1 on: June 23, 2021, 09:54:00 am »
Worked on version 1.1 of the prototype design.

-Changed video out to db15hd for this style cable https://www.monoprice.com/product?p_id=568

-Added separated audio out (RCA)

-Fixed potential problem if device on first input is turned on when an another input is active then the signal would overlap. Added another max4751 before second input.

-Removed switch. Input control TBD.

-added temporary power connector.

Question
Which package version of the chip should I use?




 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #2 on: June 23, 2021, 11:04:35 am »
You're going to have to capacitively couple and bias the audio.
The 4751 does not go below ground.
 

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #3 on: June 24, 2021, 01:42:41 am »
Thank You!

I think the sync (composite video) would have the same problem.

Would these chips work without coupling?

Sync
https://datasheets.maximintegrated.com/en/ds/MAX4529.pdf

Audio
https://datasheets.maximintegrated.com/en/ds/MAX14689.pdf

Thanks
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #4 on: June 24, 2021, 11:42:05 am »
The 4529 is a "T" switch, a much better switch than the normal "SPST" CMOS switches.
It also goes for $3 in single units.

You've got 4 different signals:
  • RGB = 0 to 0.7
  • HV = TTL
  • Composite = -0.3 to 0.7
  • Audio = ~ -0.5 to 0.5
With the RGB & composite you have to watch for crosstalk.
Especially since your sources aren't synced.
A good layout and the 4529 will certainly do the job, but is it overkill?

Do you really want to bundle the RGB and composite?
No device is going to put out both (and if they did you'd just take the RGB).

I dunno, wouldn't you just modify anything composite with an RGB output?
That seems easier/better to me.
 

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #5 on: June 24, 2021, 10:02:43 pm »
Sorry my inconsistent terminology usage seems to have caused some confusion. The switch will be used for RGBS not RGBHV.

The "Sync" line might carry "C sync", Luma or Composite Video. Preferably Luma but possibly composite video.
https://www.retrorgb.com/sync.html

Thanks
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #6 on: June 24, 2021, 10:37:28 pm »
Um, right. You did say that you were using a PVM monitor.
Why don't you use normal BNC cables for the output at least.
Why not sync-on-green?

Are you planing on looping through the composite input to the sync input for the RGB?
You really wouldn't rather just retrofit whatever is composite to RGB?
 

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #7 on: June 25, 2021, 01:45:35 am »
Um, right. You did say that you were using a PVM monitor.
Why don't you use normal BNC cables for the output at least.
Why not sync-on-green?

Are you planing on looping through the composite input to the sync input for the RGB?
You really wouldn't rather just retrofit whatever is composite to RGB?

Sync-on-green is not output by many consoles but might be the best choice for compatible consoles.

I was debating of just bnc cables from the switch to the monitor.
I was thinking about the board space saved by the vga to bnc. When I decided on the vga to bnc cable.  I but I am not set on the vga to bnc option.

Most of the consoles will use luma for sync if possible. "C Sync" seems vary greatly between console. I don't plan on using Composite video for sync unless luma or "C Sync" are not compatible with that tv and console combination. This switch currently designed for the RGBS output devices only.  A separate switch will be used for composite and s-video only devices (laserdisc, vhs, NTSC Gamecube...)


 


 

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #8 on: July 03, 2021, 12:22:57 pm »
Updates:
Ordered parts for cables. These will be tested separately with a temporary breakout cable.
Began work on the full scale design.

Changes:
9 Inputs
2 Switchable Outputs (not matrixed)
Bypassable Processor loop (Extron 202vRGB RXi for supergun/consolized arcade video alignment)

Questions:
      Input control
      To select an input two lines must driven high and one driven low.
      I was thinking a microcontroller would be an good way to control the inputs and possibly display the name of the input.
      There are a lot of choices how to accomplish this, standalone Arduino, integrated micro or a different standalone.
      Any suggestions or notes for  microcontroller use. Or buttons and latches instead? 

     


 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #9 on: July 03, 2021, 01:46:20 pm »
Why don't you move that inline coneector closer in or on the top.
Every square inch of PCB you save is money.
I don't mean for you to move the backplane connectors closer, but there is a bunch of trimming that you can do.

I built a 4 in/4out matrix once.
Since the matrix itself was a bunch of work the first controller I had was 4 BCD thumbwheel switches.
Later I build a controller that worked off an existing control bus.
It didn't even require a µC, just some latches and stuff.

Well, what kind of control do you need? Network? IR? Pushbutton?
An OLED display would look nice.
Anything on the AVR8-STM-RPi continuum would do the job.
Most people would just grab what they know best.
 

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #10 on: July 05, 2021, 09:33:35 pm »
Why don't you move that inline coneector closer in or on the top.
Every square inch of PCB you save is money.
I don't mean for you to move the backplane connectors closer, but there is a bunch of trimming that you can do.

I built a 4 in/4out matrix once.
Since the matrix itself was a bunch of work the first controller I had was 4 BCD thumbwheel switches.
Later I build a controller that worked off an existing control bus.
It didn't even require a µC, just some latches and stuff.

Well, what kind of control do you need? Network? IR? Pushbutton?
An OLED display would look nice.
Anything on the AVR8-STM-RPi continuum would do the job.
Most people would just grab what they know best.

I was initially thinking pushbuttons, but now maybe a simple menu with a rotary encoder and screen on an Arduino.
It would be nice to use the Arduino to send an ir command out to the secondary switch(composite/svideo) which has an ir remote allowing the Arduino to control the entirety of video switching.

It seems like some sort of latching control could help the number of pins needed to control the switch, but I am not sure if it would help enough to figure it out.

 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #11 on: July 05, 2021, 10:08:48 pm »
So now it's 12 inputs?
Why so much control wiring coming in?
Don't you just need 4 bits going to a 1 of 16 demux?
Unless you want to split to select the A & V separately.

Some might use an I²C latch or use SPI to reduce line count but 4 is already pretty low.
 
The following users thanked this post: 7th_Star

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #12 on: July 05, 2021, 11:46:44 pm »
So now it's 12 inputs?
Why so much control wiring coming in?
Don't you just need 4 bits going to a 1 of 16 demux?
Unless you want to split to select the A & V separately.

Some might use an I²C latch or use SPI to reduce line count but 4 is already pretty low.

A demux exactly what I needed. Thanks!
That will make it much easier to control. (I thought I would need 2 pins for every input, one for the 4887/4751(high) and one for the 4529(low).

Now I need to figure out how to use the output of the demux to drive one line low while driving the other line high.

Thanks

The number of input and outputs has not changed. (9in, 2out and 1 processor loop)
 

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #13 on: July 10, 2021, 11:20:46 am »
For input control my thought is to use one CD74HC4514 (4529 high = unselected input) and one CD74HC4515 (low = unselected input). I tried flip flops but could not find a way that did not end up super complicated.
https://www.ti.com/lit/ds/symlink/cd74hc4515.pdf

Attached is the page describing the monitor remote connecter. It recommends a series of interconnected switches to make the remote. This leads me to think relays would be the best way to control it with a Arduino??
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #14 on: July 10, 2021, 06:09:51 pm »
Relays would certainly work, but they are big and old-fashioned and not really hip.
Optoisolators would do the job, but since you are connected with big fat grounded coax cables they won't be isolating anything.
You could just just use transistors as switches or even a low threshold MOSFET like the ubqiuitous 2N7200 or 2N7202 (lower threshold).
You can check the resistance of the pullups by connecting your milliamp meter between ground and a switch input.
I presume it will be a milliamp or two?

The fact that they say "parallel control input" presumes that there is a serial control input somewhere.
It's probably more homework to do the same thing, but you get points for being cool. 8)
 
The following users thanked this post: 7th_Star

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #15 on: July 10, 2021, 10:16:04 pm »
Transistors would be better than relays. All but the tally light  measured at 3mA with the tally light measuring 27mA. (Note the tally light is just for fun and might stay off most of the time)

I could use a good resource on how to choose and connect an appropriate transistor.

I have the power supply(working) from a non functioning extron IN1508. It has +5v and -5v. Pic attached I think this might make a great power supply for the video switch. Unless there is a reason it will not work.

Cable came in and I started on the test breakout cable and the video cables. I think this will make for amazing video cables.
 

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #16 on: July 26, 2021, 01:09:53 am »
I figured out a way to reduce the control lines by changing the signal path in what now seems obvious.

Decided on this for the tv control.
https://www.ixysic.com/home/pdfs.nsf/www/CPC1217.pdf/$file/CPC1217.pdf

The control screen came in and I started on the Arduino control.

Here is the current version. I think that I will have to move up to a better Arduino. I am out of ram and can not find a solution. All of the features (outputs, input display, screen timeout, last input remember, input set indication) are there and work until it runs out of ram. (the screen buffer eats most of the ram)

I think a Arduino with more ram should work unless I am missing something.

"Sketch uses 23286 bytes (72%) of program storage space. Maximum is 32256 bytes.
Global variables use 1556 bytes (75%) of dynamic memory, leaving 492 bytes for local variables. Maximum is 2048 bytes.
Low memory available, stability problems may occur."

https://youtu.be/A79wkH5ajHU

Here is the code if anyone has any ideas
Code: [Select]
#include <Arduino.h>
#include <U8g2lib.h>
#include <EEPROM.h>
#include <Wire.h>
#define CLK 2
#define DT 3

byte currentStateCLK;
byte lastStateCLK;
byte input = EEPROM.read(0);
byte currentinput = 0;
byte dplayedinput = 1;
unsigned long lastdisplaychange = 0;
unsigned long currenttime = 0;
unsigned long encodewait = 0;

const byte demuxout[] PROGMEM = {B00100000,B00000000,B00100000,B00000000,B00100000,B00000000,B00100000,B00000000,B00100000,B00000000,B00100000,B00100000,B00000000,B00100000,
B00000000,};

const byte x1[] PROGMEM = {13,16,20,3,33,34,32,25,8,35,42,5,15,38,14};

const char console_1[] PROGMEM = "Playstation";
const char console_2[] PROGMEM = "Gamecube";
const char console_3[] PROGMEM = "Laserdisc";
const char console_4[] PROGMEM = "Playstation 2";
const char console_5[] PROGMEM = "Saturn";
const char console_6[] PROGMEM = "Xbox";
const char console_7[] PROGMEM = "SNES";
const char console_8[] PROGMEM = "Genesis";
const char console_9[] PROGMEM = "Master System";
const char console_10[] PROGMEM = "VCR";
const char console_11[] PROGMEM = "PC";
const char console_12[] PROGMEM = "Casio Loopy";
const char console_13[] PROGMEM = "PC Engine";
const char console_14[] PROGMEM = "NES";
const char console_15[] PROGMEM = "Super Nova";

PGM_P const console[] PROGMEM = {console_1,console_2,console_3,console_4,console_5,console_6,console_7,console_8,console_9,console_10,console_11,console_12,console_13,
console_14,console_15};

const char tvset_1[] PROGMEM = "AUX RGB 0";
const char tvset_2[] PROGMEM = "Y/C 1";
const char tvset_3[] PROGMEM = "Video A 2";
const char tvset_4[] PROGMEM = "AUX RGB 3";
const char tvset_5[] PROGMEM = "AUX RGB 4";
const char tvset_6[] PROGMEM = "AUX RGB 5";
const char tvset_7[] PROGMEM = "AUX RGB 6";
const char tvset_8[] PROGMEM = "AUX RGB 7";
const char tvset_9[] PROGMEM = "AUX RGB 8";
const char tvset_10[] PROGMEM = "Video B 9";
const char tvset_11[] PROGMEM = "Video B 10";
const char tvset_12[] PROGMEM = "Video B 11";
const char tvset_13[] PROGMEM = "Video B 12";
const char tvset_14[] PROGMEM = "Video B 13";
const char tvset_15[] PROGMEM = "AUX RGB   System";

PGM_P const tvset[] PROGMEM = {tvset_1,tvset_2,tvset_3,tvset_4,tvset_5,tvset_6,tvset_7,tvset_8,tvset_9,tvset_10,tvset_11,tvset_12,tvset_13,tvset_14,tvset_15};

const char switchb_1[] PROGMEM = "";
const char switchb_2[] PROGMEM = "Switcher 2  Input 1";
const char switchb_3[] PROGMEM = "";
const char switchb_4[] PROGMEM = "";
const char switchb_5[] PROGMEM = "";
const char switchb_6[] PROGMEM = "";
const char switchb_7[] PROGMEM = "";
const char switchb_8[] PROGMEM = "";
const char switchb_9[] PROGMEM = "";
const char switchb_10[] PROGMEM = "Switcher 2  Input 2";
const char switchb_11[] PROGMEM = "Switcher 2  Input 3";
const char switchb_12[] PROGMEM = "Switcher 2  Input 4";
const char switchb_13[] PROGMEM = "Switcher 2  Input 5";
const char switchb_14[] PROGMEM = "Switcher 2  Input 6";
const char switchb_15[] PROGMEM = "Kaneko";

PGM_P const switchb[] PROGMEM = {switchb_1,switchb_2,switchb_3,switchb_4,switchb_5,switchb_6,switchb_7,switchb_8,switchb_9,switchb_10,switchb_11,switchb_12,switchb_13,
switchb_14,switchb_15};

U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);


void setup(void) {
 
  u8g2.begin();

  if (input < 0 || input > 14){
  input = 0; 
  }

  //Serial.begin(9600);

  DDRB = B00111111;
  DDRD = B00000010;

  //pinMode(CLK,INPUT);
  //pinMode(DT,INPUT);
   
  lastStateCLK = digitalRead(CLK);
 
  attachInterrupt(0, Encoderchange, CHANGE);
  attachInterrupt(1, Encoderchange, CHANGE);

  //bootscreen();
  displayinput();
  setinput();
}

void loop(void) {

  currenttime = millis();
 
  if (dplayedinput != input){
    displayinput();} 
 
  if (input != currentinput && currenttime > lastdisplaychange){
    setinput();}

  if (currenttime + 1001 - lastdisplaychange > 10000){
    u8g2.clearBuffer();
    u8g2.sendBuffer();
  }

  //input++; //Repeat all inputs
  //delay(1000);
 
}

void displayinput(){


  u8g2.clearBuffer();
 
  if (input == 8) {
  u8g2.setFont(u8g2_font_crox4t_tf);
  }
  else if (input == 14) {
  u8g2.setFont(u8g2_font_helvB12_tf);
  }
  else{
  u8g2.setFont(u8g2_font_crox5t_tf);   
  }

  byte buffer6 pgm_read_byte(&x1[input]);
  char buffer1[strlen_P(console[input])];
  strcpy_P(buffer1, (PGM_P)pgm_read_word(&console[input]));
  u8g2.drawStr(buffer6,38,buffer1);
 
  u8g2.setFont(u8g2_font_t0_12_mr);
  char buffer2[strlen_P(tvset[input])];
  strcpy_P(buffer2, (PGM_P)pgm_read_word(&tvset[input]));
  u8g2.drawStr(7,55,buffer2); 

  u8g2.setFont(u8g2_font_t0_12_mr);
  char buffer3[strlen_P(switchb[input])];
  strcpy_P(buffer3, (PGM_P)pgm_read_word(&switchb[input]));
  u8g2.drawStr(7,15,buffer3);

  //Serial.println(input);
  u8g2.sendBuffer();
  lastdisplaychange = currenttime + 1000;
  dplayedinput = input;
   
}

void Encoderchange(){

  currenttime = millis();

  currentStateCLK = digitalRead(CLK);
 
  if (currentStateCLK != lastStateCLK  && currentStateCLK == 1 && currenttime >= encodewait){
   
    if (digitalRead(DT) != currentStateCLK)
    {if (input > 0) {input --;}
     else {input = 14;}}
    else
    {if (input < 14) {input ++;}
     else {input = 0;}}
     encodewait = currenttime + 350;
  }
     lastStateCLK = currentStateCLK;
}

void setinput(){

 byte buffer5 pgm_read_byte(&demuxout[input]);
 PORTB = buffer5;
 EEPROM.write(0, input);   
 u8g2.drawFrame(0,0,128,64);
 u8g2.sendBuffer();
 currentinput = input;
 
}

//void bootscreen(){
 
 //u8g2.setFont(u8g2_font_t0_12_mr);
 //u8g2.drawStr(15,20,"Custom Video");
 //u8g2.drawStr(25,35,"Switch");
 //u8g2.drawStr(50,55,"V.75b");
 //u8g2.sendBuffer();
 //delay(3000);
     
//}
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #17 on: July 26, 2021, 11:05:42 am »
You've got 200 lines of code... and a big u8g2 library which takes 1024 bytes just for the frame buffer.
(That is a 64 x 128 OLED?)
Try commenting out all the u8g2 stuff just to see how big that builds.

Sure, you could go to a bigger processor.

If you keep your text aligned with the eight 8 bit "stripes" you don't need a frame buffer.
Probably your smallest text would be 16 pixels high.
You could make the big stuff 24 or 32 pixels high.
Of course you'd have to rewrite your display library.

That's interesting the IXYS optoisolator.
The form factor, pinout is as a replacement for those SIP reed relays.
Even the fact that they put a resistor in.
 

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #18 on: July 26, 2021, 11:13:35 pm »
You've got 200 lines of code... and a big u8g2 library which takes 1024 bytes just for the frame buffer.
(That is a 64 x 128 OLED?)
Try commenting out all the u8g2 stuff just to see how big that builds.

Sure, you could go to a bigger processor.

If you keep your text aligned with the eight 8 bit "stripes" you don't need a frame buffer.
Probably your smallest text would be 16 pixels high.
You could make the big stuff 24 or 32 pixels high.
Of course you'd have to rewrite your display library.

That's interesting the IXYS optoisolator.
The form factor, pinout is as a replacement for those SIP reed relays.
Even the fact that they put a resistor in.

I compiled this with the  u8g2 lines commented out and the result is ...

Sketch uses 3296 bytes (10%) of program storage space. Maximum is 32256 bytes.
Global variables use 144 bytes (7%) of dynamic memory, leaving 1904 bytes for local variables. Maximum is 2048 bytes.

Code: [Select]
#include <Arduino.h>
//#include <U8g2lib.h>
#include <EEPROM.h>
#include <Wire.h>
#define CLK 2
#define DT 3

byte currentStateCLK;
byte lastStateCLK;
byte input = EEPROM.read(0);
byte currentinput = 0;
byte dplayedinput = 1;
unsigned long lastdisplaychange = 0;
unsigned long currenttime = 0;
unsigned long encodewait = 0;

const byte demuxout[] PROGMEM = {B00100000,B00000000,B00100000,B00000000,B00100000,B00000000,B00100000,B00000000,B00100000,B00000000,B00100000,B00100000,B00000000,B00100000,
B00000000,};

const byte x1[] PROGMEM = {13,16,20,3,33,34,32,25,8,35,42,5,15,38,14};

const char console_1[] PROGMEM = "Playstation";
const char console_2[] PROGMEM = "Gamecube";
const char console_3[] PROGMEM = "Laserdisc";
const char console_4[] PROGMEM = "Playstation 2";
const char console_5[] PROGMEM = "Saturn";
const char console_6[] PROGMEM = "Xbox";
const char console_7[] PROGMEM = "SNES";
const char console_8[] PROGMEM = "Genesis";
const char console_9[] PROGMEM = "Master System";
const char console_10[] PROGMEM = "VCR";
const char console_11[] PROGMEM = "PC";
const char console_12[] PROGMEM = "Casio Loopy";
const char console_13[] PROGMEM = "PC Engine";
const char console_14[] PROGMEM = "NES";
const char console_15[] PROGMEM = "Super Nova";

PGM_P const console[] PROGMEM = {console_1,console_2,console_3,console_4,console_5,console_6,console_7,console_8,console_9,console_10,console_11,console_12,console_13,
console_14,console_15};

const char tvset_1[] PROGMEM = "AUX RGB 0";
const char tvset_2[] PROGMEM = "Y/C 1";
const char tvset_3[] PROGMEM = "Video A 2";
const char tvset_4[] PROGMEM = "AUX RGB 3";
const char tvset_5[] PROGMEM = "AUX RGB 4";
const char tvset_6[] PROGMEM = "AUX RGB 5";
const char tvset_7[] PROGMEM = "AUX RGB 6";
const char tvset_8[] PROGMEM = "AUX RGB 7";
const char tvset_9[] PROGMEM = "AUX RGB 8";
const char tvset_10[] PROGMEM = "Video B 9";
const char tvset_11[] PROGMEM = "Video B 10";
const char tvset_12[] PROGMEM = "Video B 11";
const char tvset_13[] PROGMEM = "Video B 12";
const char tvset_14[] PROGMEM = "Video B 13";
const char tvset_15[] PROGMEM = "AUX RGB   System";

PGM_P const tvset[] PROGMEM = {tvset_1,tvset_2,tvset_3,tvset_4,tvset_5,tvset_6,tvset_7,tvset_8,tvset_9,tvset_10,tvset_11,tvset_12,tvset_13,tvset_14,tvset_15};

const char switchb_1[] PROGMEM = "";
const char switchb_2[] PROGMEM = "Switcher 2  Input 1";
const char switchb_3[] PROGMEM = "";
const char switchb_4[] PROGMEM = "";
const char switchb_5[] PROGMEM = "";
const char switchb_6[] PROGMEM = "";
const char switchb_7[] PROGMEM = "";
const char switchb_8[] PROGMEM = "";
const char switchb_9[] PROGMEM = "";
const char switchb_10[] PROGMEM = "Switcher 2  Input 2";
const char switchb_11[] PROGMEM = "Switcher 2  Input 3";
const char switchb_12[] PROGMEM = "Switcher 2  Input 4";
const char switchb_13[] PROGMEM = "Switcher 2  Input 5";
const char switchb_14[] PROGMEM = "Switcher 2  Input 6";
const char switchb_15[] PROGMEM = "Kaneko";

PGM_P const switchb[] PROGMEM = {switchb_1,switchb_2,switchb_3,switchb_4,switchb_5,switchb_6,switchb_7,switchb_8,switchb_9,switchb_10,switchb_11,switchb_12,switchb_13,
switchb_14,switchb_15};

//U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

void setup(void) {
 
  //u8g2.begin();

  if (input < 0 || input > 14){
  input = 0; 
  }

  //Serial.begin(9600);

  DDRB = B00111111;
  DDRD = B00000010;

  //pinMode(CLK,INPUT);
  //pinMode(DT,INPUT);
   
  lastStateCLK = digitalRead(CLK);
 
  attachInterrupt(0, Encoderchange, CHANGE);
  attachInterrupt(1, Encoderchange, CHANGE);

  //bootscreen();
  displayinput();
  setinput();
}

void loop(void) {

  currenttime = millis();
 
  if (dplayedinput != input){
    displayinput();} 
 
  if (input != currentinput && currenttime > lastdisplaychange){
    setinput();}

  if (currenttime + 1001 - lastdisplaychange > 10000){
    //u8g2.clearBuffer();
    //u8g2.sendBuffer();
  }

  //input++; //Repeat all inputs
  //delay(1000);
 
}

void displayinput(){


  //u8g2.clearBuffer();
 
  if (input == 8) {
  //u8g2.setFont(u8g2_font_crox4t_tf);
  }
  else if (input == 14) {
  //u8g2.setFont(u8g2_font_helvB12_tf);
  }
  else{
  //u8g2.setFont(u8g2_font_crox5t_tf);   
  }

  byte buffer6 pgm_read_byte(&x1[input]);
  char buffer1[strlen_P(console[input])];
  strcpy_P(buffer1, (PGM_P)pgm_read_word(&console[input]));
  //u8g2.drawStr(buffer6,38,buffer1);
 
  //u8g2.setFont(u8g2_font_t0_12_mr);
  char buffer2[strlen_P(tvset[input])];
  strcpy_P(buffer2, (PGM_P)pgm_read_word(&tvset[input]));
  //u8g2.drawStr(7,55,buffer2); 

  //u8g2.setFont(u8g2_font_t0_12_mr);
  char buffer3[strlen_P(switchb[input])];
  strcpy_P(buffer3, (PGM_P)pgm_read_word(&switchb[input]));
  //u8g2.drawStr(7,15,buffer3);

  //Serial.println(input);
  //u8g2.sendBuffer();
  lastdisplaychange = currenttime + 1000;
  dplayedinput = input;
   
}

void Encoderchange(){

  currenttime = millis();

  currentStateCLK = digitalRead(CLK);
 
  if (currentStateCLK != lastStateCLK  && currentStateCLK == 1 && currenttime >= encodewait){
   
    if (digitalRead(DT) != currentStateCLK)
    {if (input > 0) {input --;}
     else {input = 14;}}
    else
    {if (input < 14) {input ++;}
     else {input = 0;}}
     encodewait = currenttime + 350;
  }
     lastStateCLK = currentStateCLK;
}

void setinput(){

 byte buffer5 pgm_read_byte(&demuxout[input]);
 PORTB = buffer5;
 EEPROM.write(0, input);   
 //u8g2.drawFrame(0,0,128,64);
 //u8g2.sendBuffer();
 currentinput = input;
 
}

//void bootscreen(){
 
 //u8g2.setFont(u8g2_font_t0_12_mr);
 //u8g2.drawStr(15,20,"Custom Video");
 //u8g2.drawStr(25,35,"Switch");
 //u8g2.drawStr(50,55,"V.75b");
 //u8g2.sendBuffer();
 //delay(3000);
     
//}

 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #19 on: July 27, 2021, 12:05:10 am »
You could even just compose graphics on your desktop.
Each frame is only 1k, but of PROGMEM, not RAM.

This is something I did with the "stripes" idea.
There are 2 stripes chars, 1 stripe space, 2 stripes char, 1 stripe space, 2 stripes char = 8 stripes.
Flash:   14958
RAM:      1081
 
The following users thanked this post: 7th_Star

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2389
  • Country: gb
  • Recovering Electrical Engineer
Re: Custom RGBS and Audio Switch
« Reply #20 on: July 27, 2021, 12:28:39 pm »
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #21 on: July 27, 2021, 05:22:16 pm »
Will be far cheaper than your build.
Notice that that doesn't take any power in.
I'd guess that it's a mechanically interlocked switch?
 

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #22 on: July 29, 2021, 01:09:07 am »
https://www.amazon.co.uk/Component-Switch-Splitter-Selector-Converter/dp/B01M4LOU12

Will be far chepaer than your build.

I think there might be some confusion involving the prototype sketch and the final design features.
The finished switch will have 9 RGBS inputs, two switchable outputs, bypassable processor loop, and tv input control. 

Implemented the solution to the memory problems. Page mode with Bitmaps instead of text in full buffer mode.
 An LED (now represented by the built in LED) will show that the input is set. Fixed the known bug involving switching back to the same quickly did not set the input.  Once the board design is finished then the pin output patterns can be programed and then the control software will be finished.

https://youtu.be/Msq2QOIPO8U

Sketch uses 29028 bytes (89%) of program storage space. Maximum is 32256 bytes.
Global variables use 692 bytes (33%) of dynamic memory, leaving 1356 bytes for local variables. Maximum is 2048 bytes.
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #23 on: July 29, 2021, 10:26:16 am »
Looking good.
Are you using the knob pushbutton for "take"?
I'd think that switching on knob rotation itself would be kind of distracting.
 

Offline 7th_StarTopic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: Custom RGBS and Audio Switch
« Reply #24 on: July 30, 2021, 09:32:06 am »
Looking good.
Are you using the knob pushbutton for "take"?
I'd think that switching on knob rotation itself would be kind of distracting.

Every time the knob changes the screen the input set light turns off and a 1sec counter is started if the knob has not moved after that 1sec then the selected input is set and the "input set" led turns on. So the inputs are not changing as the knob is moving.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf