Flat box question


So I bought the recommended version of the Arduino and got it all wired up but get the same error message “Failed to get status” from SGP. Using the Arduino Serial Monitor I can send commands to the panel and it reacts properly - I can turn the light on and off and adjust brightness. I am a bit confused as to why it appears to react properly to commands sent manually via the Serial Monitor but SGP still fails to connect properly.

Any thoughts as to what I am doing wrong here?



Can you upload a zip of the Arduino code someplace and I can take a look. It may be that the response looks correct but is missing something like an End of Line character or something is malformed.


Thanks - I copied the sketch from the Arduino application and pasted it into a word document available here:

It is odd that the command set works fine when manually sent via the Serial Monitor but not with the application.

Thanks again



Please try this.


Bingo! That works! If you don’t mind me asking, what were the changes? My knowledge is fairly basic, but from what I can tell you added in some code that appears to deal with the serial communications and changed a \r to a \n in the serialreadbytes commands. I am presuming that it was not waiting long enough to get a response or something like that and timing out too quickly.

Anyway, much appreciated!


1 Like

Glad that this script works for you. Actually I am not a coding guy as well. But I learn hard to understand this lightbox coding and do a lot of research by looking at forums. :slight_smile:

Do share the result if possible.

clear skies.

You are a better forum navigator that I, clearly! Also, I like the handle! I have shared it with a friend of mine who is a coder so perhaps he can provide some clarification. Once I get that I will report back.


I wonder if something is broken in that branch. Looks like the change was made to the “serial available” check but that seems like more of a red herring. If you don’t need the stepper motor support you may want to try the original which I created and can be found here:

Thank you,

Thanks Jared - keeping track of the branches and forks of these things can be a challenge for me. I downloaded that version and it works perfectly. If I leave the brightness at 255 when I disconnect the panel stays on - I will just have to remember to set that to zero at the end of a flats session.

I appreciate all of your and Tomastro’s help on this!


Hi Tom,

That’s been an issue with the flat panel for as long as i can remember with SPG. What I always do is follow my flats with at least one bias frame and that always turns the flat panel off. I never make the flats the last thing. If I do the flat panel will not turn off. Doing a bias at the end keeps me from having to remember to manually turn the panel brightness down to zero.

I thought I brought this issue up about the panel not turning off if it’s on or if it’s the last thing when SPG disconnects a while back but I don’t think it ever got looked at.