Mega2560 PWM PIN power

Hi Folks! Apologies if this is the wrong category for this post. I've searched the forums and have not found anything related so again apologies if this has been answered before.

I'm making a camera dolly and have have two things to drive, the camera & servo from a MEGA2560. Ignore the servo. I originally used a transistor based circuit to drive the camera until my optocoupler arrived, which worked great. However I cannot get it to function using the optocoupler solution. I hooked up an LED and found it was barely being lit, but the circuit was working to a point. When I hook up the same code to the "status LEDs" its the same, the LED's are barely lit. I've tested and all the PWM ports are pumping out ~4.6v so its not a voltage problem.I then test each of the 3 circuits (LEDs, Transistor, Optocoupler) on PIN13 which is synced with the boards' led and i get full power to the LEDs, camera triggers correctly, and optocoupler LED lights up fully. Also get ~4.6v.

So it just seems that when run of PWM pins 2-12 & all of the Digital pins the problem occurs, only off PIN13 do i seem to get anything to work properly.

I dont see this as a coding problem, I'm simply just doing digitalWrite([PIN], [HIGH/LOW]); but can provide code if its suspect. One thing i haven't mentioned is current, which i am pretty naive to.

I'm pretty stumped and would appreciate any feedback! Thanks!

Maybe step back, load a brand new sketch and start testing your pins to make sure none are dead from being shorted. The way they are designed, they can exhibit several different symptoms when damaged. They might read ok, but be unable to drive high and/or low depending upon how they were damaged.

I can't tell for sure if your top two bus strips are both positive or if one is supposed to be ground, looks like they are both positive. Do you have a schematic for the circuit?

thanks! Ok have just done that - same behavior, tested all PWM and (most) digital pins with the same faint glow from an led. I also notice that testing any of the circuits directly off the 5v pin works good too as well as PIN 13. I would hate to think that all pins were borked in some way, most have never been used.

Also note, Digital pins 22-37 are all in use with an LCD which has no problems. I've disconnected 5v from the LCD to rule that out in some way.

The red jumper going straight down the BB can be misleading, thats gnd. Top rail is positive and 2nd rail in gnd
And sorry but no schematic, i've done it in a very unprofessional means stage by stage.

So, on that 2n2222 you have the collector grounded?

afremont:
So, on that 2n2222 you have the collector grounded?

Yep - thats the yellow jumper coming down from the gnd rail (2nd from top)

Based on this

You have
pinMode(pinX, OUTPUT);

for all the pins in question?
You'd be surprised how often that is left out.

CrossRoads:
You have
pinMode(pinX, OUTPUT);

for all the pins in question?
You'd be surprised how often that is left out.

CrossRoads.... I love you - i hate myself for being so stupid but wow..... thank you!!

Shit happens. I've done it too. Had an LED on D8, took me forever to figure out why my code to make D13 change just wouldn't make that D8 LED change.

I don't understand grounding the COLLECTOR of an NPN transistor in this situation; the EMITTER on the other hand....

Actually the yellow gnd jumper was a leftover accident from a test, but yeah I had the two + connected to the emitter and the shutter cable gnd connected to the collector.... now that you've pointed it out I see my mistake, but i guess it doesnt matter when using it in the manner I am?

Thanks for the help gents

With NPN used to pull a signal Low, you want the emitter connected to Gnd and the signal that gets pulled low connected to the collector.
Make sure you connect all GNDs together.

Advice actioned, many thanks!