How to build a controller for my arduino?

TL;DR:

How do I connect my arduino on one end, a usb or rj45 cable in the middle, and my joystick and switches on the other.


Hey y'all!

I'm new here. After years of procrastinating, I finally got around to learning how to build robots. :tada:

I run a video studio where everything is pretty much automated: cameras, microphones, doors, lights and such. I managed to do most of my automations with Homme Assistant. Everything is going great and my clients LOVE the setup.

But now, I want to take things one step further and automate the pan/tilt/zoom/height of my cameras. That way, the studio can "reset itself" when the client comes into the studio and he could even setup presets he could quickly load to have a consistent recording environment.

After a month or so of tinkering, I've succesfully designed the pan/tilt/zoom/height thingy (let's call it PTZH) and I've programmed it to subscribe to my mqtt server and await instructions. Everything works great!

Now, I've come to never trust wireless technology. Internet may fail or my server may go offline. Since my studios are unsupervised, the user needs to have a way to adjust the cameras manually in case the app fails.

I could just tuck the controls into each of the devices, but I think it would be a more elegant design if I had a controller that we could just plug into the different PTZH to control them.

My controllers needs a joystick, a rocker switch and a potentiometer. How would I go about connecting that to my PTZH?

I've seen a bunch of devices, but I'm not sure which ones I need. I have no Idea what types of communications protocol I need to use.

RJ45 to UART, Serial, I2C, SPI?

Do I need an arduino mini in my controller on the other end to encode and transmit the data?

Should I skip cables and do it over IR?

How would a more experienced user go about it?

For context, I come from the JavaScript/Php world so I understand the concepts of programming, but this is my first time with C. I can do basic 3d modelling and I have an Ultimaker S5 to help with the prototyping.

Please decide if you are wanting a "HOT" plug in device so all power does not have to be removed, or "COLD" plug in device where all power is first removed, the new device plugged in, ant now power is turned back on.

Interesting project, posting here to follow the progress.

But what exactly is your 'thingy'? It's arduino right?

Just a thought, but I think it might be useful to separate/think in terms of 'standard' and 'protocol'.

And judging on the info I'd say 'hot plugging' is a requirement.

Yes, I would to be able to just plug it in at any moment.

Yes, It's an Arduino Uno Wifi Rev2.

You lost me there. :stuck_out_tongue: I guess the standard would be the RJ45 plug and the protocol is the way in which I encode/decode the data?

When connecting USB devices like joysticks to microcontrollers, you typically need a USB host controller to handle the device to device comms over the USB port. Personally, I hate the normal USB host controller shields you might find on Amazon/ebay.

The best approach (IMHO) is to use a Teensy 3.6, Teensy 4.0, or Teensy 4.1 as your "Arduino". Each of these 3 have built-in USB host functionality with library support.

You could also create your own controller using analog or hall effect joysticks and buttons on a custom 3D printed frame and any Arduino of your choice.

[correct me if I'm wrong on this anyone]
Yeah, it took me a while to understand those terms too, but I think you're on the right track.
Basically:

--Standard: Sound waves
--Protocol: Language
Both Mexicans and Chinese people make sound waves that they both can produce and and hear.
But they don't understand each other because they speak another 'protocol' (= language).

--Standard: Light signals
--Protocol: Morse code
Two people both can see light signals.
They can only understand each other if they both know Morse code.

--Standard: Voltage levels
--Protocol: Numerous
Two boards know voltage levels.
They can only understand each other if they both are able to decode the sequence of one's and zero's.

So basically, first decide on the preferred way to connect your 'emergency controller' to your 'PTZH thingy' Infrared, USB, WiFi, or a even simple headphone jack.

Wow, I wasn't expecting much when I posted here, but this forum is great!

So... First question!

Your answer seems to imply that I absolutely NEED to have 2 arduinos and make em talk to each other. I can't just hot plug a dumb controller.

I was wondering If I couldn't just use this:

And basically use the ethernet cable as a long extention that hot plug/deplug my controller.

Can this be done?

Now, if I can't and I need 2 arduinos linked together, can I use the regular USB port that's already on the arduinos? Or do I need to install another USB chip like this?

PL2303 USB UART Board (Type C), USB to UART (TTL) Communication Module, USB-C - RobotShop

And then I simply plug them in the rx/tx pins on the board.

Final question, when I'm using the RX/TX pins, does it dump the data in the serial buffer just like when I plug the Arduino into my computer?

Thank you! From what I understand, UART seems to be the way to go since I can just plug it into my board. From there, I can use any type of interface I want (RJ45, USB).

What would you do if you were in my position?

You will definitely need some type of error detection and control/recovery if you decide to use this.

I may be confused, but depending on how far the controls are from the controlled, you may be able to just run the (joystick, pushbutton, potentiometer) signals over a cable.

About 3 meters so not that far away!

Is there a name for "a big cable with a bunch of cables inside"? :stuck_out_tongue: My Google searchs arn't returning anything good.

Multi-conductor comes to mind.

It seems you decided on a wired plug and play RJ45 cable connection.
Nice choice since since RJ45 ethernet cables are widely available and for grabs anywhere.

The connector in the picture just connects the ethernet wires

[quote="olivier_lambert, post:10, topic:1041559"]
Is there a name for "a big cable with a bunch of cables inside"?
[/quote]I think USB cable would be perfectly fine? Not talking about the USB protocol, just the cable, the hardware. You basically have a widely available type of cable with 4 wires inside + shielding. Google for 'USB pinout' and 'USB breakout'

Have a look at:

And maybe:

IR sounds like it could be a good idea to me. Equip each PTZH with an IR receiver (cheap and only one digital pin required). Give the central remote a multi-way switch to select which PTZH is to be adjusted.

Tricky parts of the project is using IR would be generating bright enough signals that all PTZH devices will pick them up, regardless of where they are placed and the direction the remote control is pointing. Without that, they may not receive the signals that say "I want to control PTZH #2, so PTZH #1 and PTZH #3 etc should ignore the following signals".

Here's a search filter

Select number of conductors and length and you should be able to find something you can use.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.