Ideas for attaching a new LED and allowing the LED to be controlled by G-code?
 
Notifications
Clear all

Ideas for attaching a new LED and allowing the LED to be controlled by G-code?  

  RSS
earlz
(@earlz)
New Member
Ideas for attaching a new LED and allowing the LED to be controlled by G-code?

So I have a weird use/abuse case for my printer. I definitely don't want to break my printer and only have limited (but some) electronics experience. The core thing I need hardware-wise is to attach a new LED to my printer (doesn't need to be bright or anything, will actually probably be quite dim) and to be capable of turning this LED on/off by using G-code. Is this at all a trivial task? Would I need new firmware or anything?

The actual project is for the purposes of creating a homebrew "film recorder" ie, basically a method of "printing" a digital image (converted to G-code) to an analog film camera. The idea is to precisely control the amount of time the LED is turned on to control the brightness of each "pixel" (currently only worried about B/W conversion) and then to move along with X/Z axis to create a large map of pixels, ideally 10K lines or so of resolution should be possible, but >4K is the real requirement.

Posted : 11/12/2019 12:00 am
bobstro
(@bobstro)
Illustrious Member
RE: Ideas for attaching a new LED and allowing the LED to be controlled by G-code?

Tom Sanladerer has a video on controlling LEDs with gcodes It does appear M42 is supported in the Prusa firmware, although not well documented. If you can confirm that M42 is supported, you can wire an LED controller (probably shouldn't wire them directly to the board) and trigger it directly in gcode. However, you have limited opportunities to call that custom gcode using most slicers. 

Controlling the LEDs from a Raspberry Pi running Octoprint is probably a more viable option as you can use a plugin or write your own code to have more granular control over the LEDs.

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Posted : 11/12/2019 12:48 am
earlz
(@earlz)
New Member
Topic starter answered:
RE: Ideas for attaching a new LED and allowing the LED to be controlled by G-code?

@bobstro

Interesting video. Why an LED controller instead of wiring directly to the board? Current concerns or something? I'd be using a fairly low light level for the LED so I'd imagine the rpi can drive it directly unless the "exposure time" for each pixel needs to be ridiculously high. And by LED controller what do you mean? Like a transistor or something to switch it on/off indirectly?

I would be basically creating my own slicer as part of this project.. well, less a slicer and more like an image -> gcode converter, since there would be no actual 3D printing happening. I need to control the LEDs from gcode because the expected gcode is something like:

move X to 100, Z to 100
turn on LED
wait 0.4s
turn off LED
move X to 101
turn on LED
wait 0.8s
turn off LED
....

I've looked at gcode before, but not ever had to write or modify it, but this project should in theory be quite simple for that part of it.

Posted : 11/12/2019 4:00 am
towlerg
(@towlerg)
Noble Member
RE: Ideas for attaching a new LED and allowing the LED to be controlled by G-code?

Pretty sure for anything more than 5mm LEDs you'll need additional hardware to drive it. A dim 5mm LED is about 10mA, I think a raspberry can drive about 15mA.

Posted : 11/12/2019 1:20 pm
Share: