I am trying to galvanically isolate a brushless ESC from my Arduinbo Uno with a optocoupler PC817.
Hi,I suspect you need to connect the opto emitter to ESC GND and collector to PWM, maybe with the pullup to 6V+.To know better, I'd need to know what ESC you have.
Ok, try this
servo.writeMicroseconds(2000 - speed + 1000);
Also is it okay to short the 6V pin with the Gnd pin like that?
Don't understand that. The last diagram only "shorted" the PWM pin to GND, there was 1K up to 6V
I experimented a bit and got a setup that seems to work (see attachment).Is this okay or is there somethin wrong with it?
Ah, good.My last diagram should've worked then ?In your diagram, when the transistor is on, the PWM pin is in the middle of 550ohm to +6V and 550ohm to GND.So the PWM signal will only switch from GND to +3V max. That might only just be working.Unfortunately the datasheet on the ESC give no information at all about the PWM input, it might have an internal pull-up which you have to 'override' with that low pull-down value of 550ohm.Really needs looking at with a 'scope.
Ok, try it the other way round...Diagram:Don't understand that. The last diagram only "shorted" the PWM pin to GND, there was 1K up to 6VYours, TonyWilk