Having problems with Skaarhoj Github Arduino ATEM Libraries

22 posts / 0 new
Last post
Offline

Location

Rome
Italy
Joined: 30/08/2017
Posts: 13
Having problems with Skaarhoj Github Arduino ATEM Libraries

Hello everyone,

I apologize in advance if my english isn't the best you'll read, although.. I just joined this forum, after reading many interesting threads. I'm currently doing a stage in a company in my country and they ask me to develop an Arduino C oriented program that emulates an ATEM 1 M/E work using an Arduino Mega. Not yet willing to discuss if it can be enough to emulate all those functions. I downloaded Skaarhoj libraries from Github as i wrote in the thread's title, but i'm having problems making it run properly. I tried to run an exaple from ATEM library but it seems some libraries can't see each others, anyone else has experienced this problem before?

I'll post some screenshots about the errors asap

Hoping to find out why things aren't working

Cheers!

Offline

Location

Rome
Italy
Joined: 30/08/2017
Posts: 13
Update

Here's a little update, promised i'd have post some screenshots for a better explanation, here they are.

http://imgur.com/a/Muset

^Here you can see the fatal error given by Arduino compiler when i try to run that example (which i modified for testing, but i'm having errors even with the clean example)

http://imgur.com/a/5MNGf

^Here's the ATEM.h file opened at the error's given codeline, 34

 

I've tried renaming that udp library, i've tried moving things, do a clean installation of those libraries but it just won't run.

In Ethernet2 library folder there is an EthernetUdp2 library, which i tried to rename it so ATEM.h would've seen that.

No luck, having tons of syntax errors.. help me please

 

Cheers!

Offline

Location

Leeds
United Kingdom
Joined: 12/07/2015
Posts: 81
Examples?

Hi,

If you click on "File" - "Examples" - do you have a list of ATEM folders / examples?  (ATEM, ATEMbase, ATEMext, ATEMmax, ATEMmin etc...)

If you do then have you tried to compile any of those examples?

All of the examples I've loaded don't have Ethernet2.h in the code.

Colin

ATEM 2 M/E 4K, ATEM 1 M/E 4K, HyperDeck Studio Pro 4K, DeckLink Mini Recorder

Custom SKAARHOJ based controller

 

Offline

Location

Rome
Italy
Joined: 30/08/2017
Posts: 13
Hey Colin, thanks for the

Hey Colin,

thanks for the answer! Yeah, i have that list of examples and yep, all examples have Ethernet.h library.

Once i get home I'll try a fresh installation of the Arduino software and libraries from Github and I'll let you know if that was the problem

 

Offline

Location

Rome
Italy
Joined: 30/08/2017
Posts: 13
News

Hey Colin,

here's the situation ----> http://imgur.com/a/ejnpc

I've opened the ATEMstd library this time, since i've read ATEM is obsolete and its usage is discouraged

Also, my coworker told me about Ethernet2, because it's necessary to communicate with our Arduino Ethernet Shield 2

So, i assume we need to buy an Arduino Ethernet shield to make things work?

 

Cheers

Offline

Location

Rome
Italy
Joined: 30/08/2017
Posts: 13
Sorry for doublepostings..

Sorry if I doublepost, but i couldn't make that library work with these libraries..

Do i really need an Arduino Ethernet Shield 1 to make this project alive?

I'm not that good at this, it's just a work i got told to do and i'm doing my best to make it

 

Thanks for further answers lots

Have a good day

Offline

Location

Leeds
United Kingdom
Joined: 12/07/2015
Posts: 81
You should be able to (as

You should be able to (as long as you have the right Arduino board selected, eg. Arduino Uno) compile / verify the code without ANY board acutally attached. Just not upload it of course!

Do you have another computer to try this on as it should be straight forward.

1. Download Arduino IDE from - https://www.arduino.cc/en/Main/Software

2. Install Arduino IDE

3. Open Arduino IDE (so it creates the correct folders)

4. Close Arduino IDE

5. Download Skaarhoj Github Arduino ATEM Libraries from - https://github.com/kasperskaarhoj/SKAARHOJ-Open-Engineering

6. Copy contents of ArduinoLibs folder to /Documents/Arduino/libraries/

7. Open Arduino

8. Click File - Examples - ATEMstd - ATEMstdMonitor

9. Click Tools - Board - Arduino/Genuino Uno

10. Click Sketch - Verify/Compile

I've probably missed something out but I'm sure this "should" work.

ATEM 2 M/E 4K, ATEM 1 M/E 4K, HyperDeck Studio Pro 4K, DeckLink Mini Recorder

Custom SKAARHOJ based controller

 

Offline

Location

Rome
Italy
Joined: 30/08/2017
Posts: 13
Maybe i
bradders wrote:

You should be able to (as long as you have the right Arduino board selected, eg. Arduino Uno) compile / verify the code without ANY board acutally attached. Just not upload it of course!

Do you have another computer to try this on as it should be straight forward.

1. Download Arduino IDE from - https://www.arduino.cc/en/Main/Software

2. Install Arduino IDE

3. Open Arduino IDE (so it creates the correct folders)

4. Close Arduino IDE

5. Download Skaarhoj Github Arduino ATEM Libraries from - https://github.com/kasperskaarhoj/SKAARHOJ-Open-Engineering

6. Copy contents of ArduinoLibs folder to /Documents/Arduino/libraries/

7. Open Arduino

8. Click File - Examples - ATEMstd - ATEMstdMonitor

9. Click Tools - Board - Arduino/Genuino Uno

10. Click Sketch - Verify/Compile

I've probably missed something out but I'm sure this "should" work.

 

Okay, maybe I explained myself wrong. I have an Arduino Ethernet shield v2 (W5200), which uses an Ethernet2 library, examples works perfectly with the old Ethernet, also i know the verify thing, I actually don't have an Arduino Uno connected when i compile the code, that's intentional.

The thing is, is there any way to let the Ethernet2 library be read by ATEMstd etc..? Or must I buy an Arduino Ethernet shield v1?

Offline

Location

Leeds
United Kingdom
Joined: 12/07/2015
Posts: 81
Ah, I didn't realise

Ah, I didn't realise everything was working fine with the old ethernet. 

Getting a different Ethernet shield is probably the best bet. I always use the cheap Arduino Wiznet Ethernet W5100 Shield like this one http://www.hobbytronics.co.uk/arduino-wiznet-shield

ATEM 2 M/E 4K, ATEM 1 M/E 4K, HyperDeck Studio Pro 4K, DeckLink Mini Recorder

Custom SKAARHOJ based controller

 

Offline

Location

buenos aires
Argentina
Joined: 12/02/2016
Posts: 3
Switch Auxiliary Output ATEM 1. Help.

Hello everyone.
 
    Apologies for my English, I have translated the text.
 
I have an ATEM 1 and I have switched previous and program by example SKAARHOJ ATEMstd, but nowhere can I find a sketch or something that tells me how to switch the auxiliary outputs.
 
I would like to know if someone can help me with the sketch to control AUX1, 2 and 3, I need to switch the auxiliary.
 
Many thanks to all and congratulations for the forum.
 
regards

Offline

Location

Leeds
United Kingdom
Joined: 12/07/2015
Posts: 81
@chcarru All the commands are

@chcarru

All the commands are available here: http://skaarhoj.com/fileadmin/BMDPROTOCOL.html

use:

AtemSwitcher.setAuxSourceInput(AUXChannel, Input);

where:

 

AUXChannel = 0-5 for Aux 1-6 (ie if you want to change Aux1 use number 0, or change Aux3 use number 2 etc...)

Input = chose the input you want from the list below and use the number in square brackets:

So for example if I want Aux4 to show input 7:

AtemSwitcher.setAuxSourceInput(3, 7);

    [0] => Black
    [1] => Input 1
    [2] => Input 2
    [3] => Input 3
    [4] => Input 4
    [5] => Input 5
    [6] => Input 6
    [7] => Input 7
    [8] => Input 8
    [9] => Input 9
    [10] => Input 10
    [11] => Input 11
    [12] => Input 12
    [13] => Input 13
    [14] => Input 14
    [15] => Input 15
    [16] => Input 16
    [17] => Input 17
    [18] => Input 18
    [19] => Input 19
    [20] => Input 20
    [1000] => Color Bars
    [2001] => Color 1
    [2002] => Color 2
    [3010] => Media Player 1
    [3011] => Media Player 1 Key
    [3020] => Media Player 2
    [3021] => Media Player 2 Key
    [4010] => Key 1 Mask
    [4020] => Key 2 Mask
    [4030] => Key 3 Mask
    [4040] => Key 4 Mask
    [5010] => DSK 1 Mask
    [5020] => DSK 2 Mask
    [6000] => Super Source
    [7001] => Clean Feed 1
    [7002] => Clean Feed 2
    [8001] => Auxilary 1
    [8002] => Auxilary 2
    [8003] => Auxilary 3
    [8004] => Auxilary 4
    [8005] => Auxilary 5
    [8006] => Auxilary 6
    [10010] => ME 1 Prog
    [10011] => ME 1 Prev
    [10020] => ME 2 Prog
    [10021] => ME 2 Prev

 

ATEM 2 M/E 4K, ATEM 1 M/E 4K, HyperDeck Studio Pro 4K, DeckLink Mini Recorder

Custom SKAARHOJ based controller

 

Offline

Location

buenos aires
Argentina
Joined: 12/02/2016
Posts: 3
Switch Auxiliary Output ATEM 1. Help.

Thank you, but thank you very much for your response and your dedication.
I have tried all these commands and more, but all with error.
most of the time they show these:
 
exit status 1
'class ATEM' has no member named 'setAuxSourceInput'
 
I have tested with these 3:
 
  if (digitalRead (2)) {
     if (pushButton! = 2) {
       pushButton = 2;
       Serial.println ("Select xx");
 
       // AtemSwitcher.setAuxSourceInput (0, [5]);
       // {AtemSwitcher.changeAuxState (1,1);} // this does not give an error but does not select anything
      //AtemSwitcher.setAuxSourceInput (1,2);
 
     }
   } else if (pushButton == 2) {
     pushButton = 0;
   }
  Will I have to declare something ?, or use another library?
 
 
From now, a strong hug by your great unconditional collaboration

Offline

Location

Daarlerveen
Netherlands
Joined: 28/02/2012
Posts: 58
Aux

Bradder did put you in the right direction..

 

But the Aux command is only supported with 

ATEMmax, ATEMext, ATEMstd, ATEMmin

So be sure you have 1 of these libraries in your code defined.. 

 

AtemSwitcher.setAuxSourceInput (0, [5]);  The [ & ] bracket are wrong.   You just need to put the number there.. Or better make a variable and put the number in there..

Daniel Wittenaar

Xtreemtec Media Productions

The Willows Developments

Offline

Location

buenos aires
Argentina
Joined: 12/02/2016
Posts: 3
Many, many thanks for your

Many, many thanks for your help.
Resolved!!
regards

Offline

Location

Rome
Italy
Joined: 30/08/2017
Posts: 13
Here I am again

Hello everyone,

I've managed to build up a prototype for now, but i'm having issues connecting the Arduino with the ATEM.

 

Here's my code: https://pastebin.com/s1xqYFSu

I made some debug and the Serial Monitor stops right after line 134

 

Am I doing something wrong? I connected the Ethernet from my Arduino Shield to the ATEM, on the ATEM is mounted a BMD monitor via HDMI.

It just freeze.

 

Waiting for someone to help me, I wish you all a good day

Gabriele

Offline

Location

Leeds
United Kingdom
Joined: 12/07/2015
Posts: 81
Trim down

I would start by trimming down the code to something really simple, like just the cut button.  That way you can test your setup is working and advance your code on from there.

First issue with the code is that you've set the "INPUT_PULLUP" on all of the buttons then say "if (val1 == 1)".  Unless all your switches are normally closed to ground and when you press the button you break the contact (which I doubt) you should really have "if (val1 == 0)" or more simply "if (!val1)".  I would imagine this is why the program is freezing as currently the program is seeing ALL the buttons as being pushed, all of the time.

Also:
AtemSwitcher.setPreviewInputVideoSource(0, 9); - should be - AtemSwitcher.setPreviewInputVideoSource(0, 1);
and all of the other preview settings need to be changed to 2, 3, 4, 5, 6, 7, 8
 
void performCutME(uint8_t mE);  - shoud be - AtemSwitcher.performCutME(0);
void performFadeToBlackME(uint8_t mE); - should be - AtemSwitcher.performFadeToBlackME(0);
void performAutoME(uint8_t mE); - should be - AtemSwitcher.performAutoME(0);
 
There may be more but as I said at the beginning, start small and build on it.

ATEM 2 M/E 4K, ATEM 1 M/E 4K, HyperDeck Studio Pro 4K, DeckLink Mini Recorder

Custom SKAARHOJ based controller

 

Offline

Location

Rome
Italy
Joined: 30/08/2017
Posts: 13
Oh..

This is an example of how things are connected on my setup. I've tested it with a Sketch not having ATEM instructions, it works well. But I guess it's a coincidence, or maybe I may be doing some damage without knowing. Can you please see that image and tell me if I'm doing something wrong?

Thanks a lot for the other tips..

Offline

Location

Leeds
United Kingdom
Joined: 12/07/2015
Posts: 81
input_pullup

By saying:

pinMode(program1, INPUT_PULLUP);

You're telling the arduino activate the internal pullup resister on that input, this way you don't need an external resister.  That input is held high (at +5) until you pull it down to ground via your switch. 

So even without the switch connected if you did a digitalRead you would get HIGH or 1 as the reponse.  When you then push the switch you short the input to ground and you should be looking for a digitalRead of LOW or 0.

See image: https://drive.google.com/file/d/1XH5mstsPAAlAlK8iIU2eAHF4vQ4vWSeV/view?usp=sharing

ATEM 2 M/E 4K, ATEM 1 M/E 4K, HyperDeck Studio Pro 4K, DeckLink Mini Recorder

Custom SKAARHOJ based controller

 

thos-berlin's picture
Offline

Location

berlin
Germany
Joined: 19/06/2012
Posts: 483
Some people use aditional

Some people use aditional pullup resistors for the button. But I think, she has teste the ciricuit. Maybe the Ethernet shield don't work. In this case, the communication to ATEM will not work. I had this issue during building my tally unit. The third shield worked...

Thomas  S e e w a l d - thos-berlin (amateur)

Offline

Location

Leeds
United Kingdom
Joined: 12/07/2015
Posts: 81
That might be true but the

That might be true but the circuit Gabriele shown is wrong for using INPUT_PULLUP as the switch is normally low and goes high when the switch is pressed.  It needs to be the other way around (low when pressed).  That was my point.

 

ATEM 2 M/E 4K, ATEM 1 M/E 4K, HyperDeck Studio Pro 4K, DeckLink Mini Recorder

Custom SKAARHOJ based controller

 

Offline

Location

Rome
Italy
Joined: 30/08/2017
Posts: 13
okay

Yeah, I'm very dumb it seems. Completly didn't realize i was putting two resistors on the button, and none on the led. wow.

So, since I've tons of 10kohm resistors.. can i use them on the led and leaving the pullup resistors? maybe those are too strong for leds?

 

Offline

Location

Leeds
United Kingdom
Joined: 12/07/2015
Posts: 81
Test code

So you can test your connection between Arduino and ATEM I've cut your code right down to 2 LEDs (Prog 1 & 2) and the CUT button.  This way you can test the LEDs and a button before moving on to the whole thing.  This does depend on you having the LEDs set so the Arduino is switching the +5v and not the GND, and that the button is connected as I described above (ie switching ground and not 5v).

https://pastebin.com/xbWa2tvC

Note: double check the IP address of the ATEM with the IP in the code.

 

ATEM 2 M/E 4K, ATEM 1 M/E 4K, HyperDeck Studio Pro 4K, DeckLink Mini Recorder

Custom SKAARHOJ based controller