Difference between revisions of "Interactive lasers"
Samneurohack (talk | contribs) (→Hardware) |
Samneurohack (talk | contribs) m (→Public events) |
||
(57 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | == Warnings == | ||
+ | |||
+ | '''Don't be stupid : LASERS ARE DANGEROUS.''' | ||
+ | <br> | ||
+ | For introduction to laser safety, a great video : 31C3 Safer playing with lasers : [http://https://media.ccc.de/v/31c3_-_6131_-_en_-_saal_1_-_201412281600_-_safer_playing_with_lasers_-_sarah#t=359 here] | ||
+ | <br> | ||
+ | For complete training (not free) : [https://www.lia.org/training/non-medical LIA] | ||
+ | |||
+ | == /team/laser == | ||
+ | |||
+ | The laser group at /tmp/lab is known as /team/laser. [http://www.teamlaser.tk http://www.teamlaser.tk] | ||
+ | <br> | ||
+ | |||
+ | ==== Public events ==== | ||
+ | * Several gamer assembly : pong game on poitiers city hall | ||
+ | * Several Toulouse Hacker Space Factory [https://www.teamlaser.fr/thsf/index.html #THSF9] | ||
+ | * Laser contests at Cookie demoparty | ||
+ | * ... | ||
+ | |||
+ | ==== LJ ==== | ||
+ | LJ is a laser framework and server for up to 4 ILDA lasers/etherdreams. You get : easy DIY plugins, alignement, monitoring,... | ||
+ | ([https://github.com/tmpbci/LJ code] and [https://www.teamlaser.tk/lj/index.html website]) | ||
+ | |||
== Goals == | == Goals == | ||
+ | |||
+ | The main idea is to add interactivity to "leisure" lasers. i.e with a gamepad one can play to old style vector games on city buildings. Again you must have control on anything in front of laser light. See picture at bottom. | ||
Different levels of complexity are possible. Commercial lasers uses ilda files/connections to draw whatever you want, but you can build your own, see hardware section. | Different levels of complexity are possible. Commercial lasers uses ilda files/connections to draw whatever you want, but you can build your own, see hardware section. | ||
− | * The very fast and easy plan is to switch ilda scenes according to some inputs. You can use already made ilda files (see download section) in a SDcard plugged inside the laser fixture and use DMX protocol to switch. DMX usb cards are cheap, usually we use enttec ones. DMX controlled lasers are cheaper | + | * The very fast and easy plan is to switch ilda scenes according to some inputs. You can use already made ilda files (see download section) in a SDcard plugged inside the laser fixture and use DMX protocol to switch. DMX usb cards are cheap, usually we use enttec ones. DMX controlled lasers are cheaper but quite limited to ilda files. |
− | * If the plan is too draw live, it depends on the laser fixture DIY or commercial. Lot of possibilities depending on the number of colors, from using an arduino, a 5.1 USB soundcard | + | * If the plan is too draw live, it depends on the laser fixture DIY or commercial. Lot of possibilities depending on the number of colors, from using an arduino, a 5.1 USB soundcard, up to use commercials (opensource) cards using the standarts ilda connect ports. |
+ | * In any way, such lasers must feature X- and Y-scanners (i.e. galvanometer-moved mirrors) in order to position the beam accurately | ||
== Hardware == | == Hardware == | ||
+ | |||
Obviously there is DIY Lasers and commercial ones and there is a bunch of cards integrating some DACs to talk to the laser fixture. <br> | Obviously there is DIY Lasers and commercial ones and there is a bunch of cards integrating some DACs to talk to the laser fixture. <br> | ||
− | A great forum for bootstrap your project is [http://laserfreak.net/forum/index.php laser freak] that comes in different langages. We play with two different setups : | + | A great forum for bootstrap your project is [http://laserfreak.net/forum/index.php laser freak] that comes in different langages. <br> |
+ | |||
+ | We play with two different setups : | ||
+ | |||
* a green DIY laser made at [http://blog.blackboxe.org/?m=201407&lang=en la Blackboxe] with a [http://www.macpod.net/electronics/lasershark/lasershark.php lasershark] USB DAC card. | * a green DIY laser made at [http://blog.blackboxe.org/?m=201407&lang=en la Blackboxe] with a [http://www.macpod.net/electronics/lasershark/lasershark.php lasershark] USB DAC card. | ||
− | * an ilda RGB commercial laser for clubs with an [http://ether-dream.com/ Etherdream] USB DAC card | + | * an ilda DB25 ports RGB commercial laser for clubs with an [http://ether-dream.com/ Etherdream] USB DAC card. |
=== Commercial Lasers === | === Commercial Lasers === | ||
− | |||
− | === Ether dream | + | '''Warning !''' Not all lasers can draw anything ! Only the ones featuring scanners (i.e. galvanometer-moved mirrors) for the X- and Y-axes can do it (unlike the cheapest ones, which only draw random patterns). |
+ | |||
+ | On commercial lasers, the standard way to drive the beam is the [http://laserfx.com/Backstage.LaserFX.com/Systems/Pinouts9.html DB25-connector-based ILDA interface] (source : laserfx.com). It is based on analog differential control signals. | ||
+ | |||
+ | Therefore you'll need some external hardware capable of outputting such signals, be it standalone or controlled by a host computer. Such hardware is usually named concisely "DAC". | ||
+ | |||
+ | === DIY Lasers === | ||
+ | |||
+ | [http://elm-chan.org/works/vlp/report_e.html] : a DIY laser projector made from scratch. | ||
+ | |||
+ | Even the galvanometers are home-built ! | ||
+ | |||
+ | In particular, there is a detailed study of the design of the galvanometers' servo loop control : galvanometers feature inertia like any mechanical devices, and achieving fast and accurate moves requires to "compensate" the galvanometers' drive signals with respect to their sensed position. | ||
+ | |||
+ | === Control boxes : DAC === | ||
+ | |||
+ | ==== [http://macpod.net/electronics/lasershark/lasershark.php Lasershark] ==== | ||
+ | |||
+ | * One color only | ||
+ | * to be used with [https://github.com/marcan/openlase/wiki openlase] | ||
+ | * USB | ||
+ | |||
+ | ==== [http://ether-dream.com/ Ether-dream] ==== | ||
+ | |||
+ | * This is an ILDA control box which can either work as standalone (displaying a sequence of ILDA scenes tored internally or on an SD-card) or receive IP frames for driving the beam. | ||
+ | * RGB capable | ||
+ | * RJ45 : The ether dream is directly tcp/IP controlled, so you can imagine very cool projects with very easy setup and of course the programming langage you prefer. | ||
+ | * The firmware is open-source (but what about the hardware ?) | ||
+ | * In depth protocol page kind of hidden [http://ether-dream.com/protocol.html] | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | === Laser Asteroids === | ||
+ | [[Image:Laser.png]] | ||
+ | |||
+ | [https://www.youtube.com/watch?v=5XTi-jf-ans (YouTube video here)] | ||
+ | |||
+ | An [https://github.com/echelon/laser-asteroids "Asteroids"-variant game from Brandon Thomas (Echelon) on GitHub] | ||
+ | |||
+ | === Laser Hexagon === | ||
+ | [http://www.tmplab.org/2015/01/30/hexagon-lazer-laser-game/ Video preview here (work in progress)]. | ||
+ | |||
+ | For more info, see [[Laser_Hexagon|project page]]. | ||
+ | |||
+ | === Laser Pinball === | ||
+ | |||
+ | Work in progress. | ||
+ | |||
+ | 2D physic for example by pymunk | ||
+ | [[Laser_Pinball]] | ||
+ | |||
+ | == Conversion from svg to ild file format == | ||
+ | |||
+ | * Use inkscape to create shapes, text,.. | ||
+ | * Use convert "object to path". | ||
+ | * Select on each letter, apply "simplify" | ||
+ | * svg2ild.py that can be found on github by marcan or search for clakoscrew. | ||
+ | * python svg2ild.py -q svgfile.scg ildfile.ild | ||
+ | |||
+ | Reminder : | ||
+ | |||
+ | * with "simplify", there is no "q" command in created svg path, that generate an error with svg2ild.py | ||
+ | * todo : debug svg2ild.py | ||
+ | |||
+ | |||
+ | === Exporting from INKSCAPE === | ||
+ | |||
+ | |||
+ | * Save as HPGL | ||
+ | * Regexp : | ||
+ | |||
+ | #!/usr/bin/python | ||
+ | import sys | ||
+ | import re | ||
+ | source = sys.argv[1] | ||
+ | content = file( source ).read() | ||
+ | L = [] | ||
+ | L.append([";","\n"]) | ||
+ | L.append(["^IN",""]) | ||
+ | L.append(["PU.*",""]) | ||
+ | L.append(["PD",""]) | ||
+ | for pattern, replace in L : | ||
+ | content = re.sub( pattern, replace, content) | ||
+ | parsed = re.split("\n", content) | ||
+ | tmp = [] | ||
+ | out = [] | ||
+ | MaxX = -9999999999999999 | ||
+ | MaxY = -9999999999999999 | ||
+ | MinX = 999999999999999 | ||
+ | MinY = 999999999999999 | ||
+ | first = None | ||
+ | for line in parsed: | ||
+ | if line == "" : | ||
+ | continue | ||
+ | tup = re.split(',',line) | ||
+ | if len(tup) < 2 : continue | ||
+ | x = int( ( int( tup[0] )) ) | ||
+ | y = int( ( int( tup[1] )) ) | ||
+ | MinX = x if x < MinX else MinX | ||
+ | MaxX = x if x > MaxX else MaxX | ||
+ | MinY = y if y < MinY else MinY | ||
+ | MaxY = y if y > MaxY else MaxY | ||
+ | tmp.append([x,y]) | ||
+ | if( first == None ): | ||
+ | first = [x,y] | ||
+ | tmp.append( first ) | ||
+ | moveX = ( MaxX + MinX ) / 2 | ||
+ | moveY = ( MaxY + MinY ) / 2 | ||
+ | for x,y in tmp: | ||
+ | newX = x - moveX | ||
+ | newY = y - moveY | ||
+ | out.append( [ newX, newY ] ) | ||
+ | print out | ||
− | * | + | |
+ | * From : | ||
+ | IN;SP1;PU778,2039;PD841,1858;PD908,2041;PU799,1983;PD887,1982;PU; | ||
+ | * To : | ||
+ | [[[778,2039],[841,1858],[908,2041]],[[799,1983],[887,1982]]] |
Latest revision as of 10:49, 20 September 2020
Contents
Warnings
Don't be stupid : LASERS ARE DANGEROUS.
For introduction to laser safety, a great video : 31C3 Safer playing with lasers : here
For complete training (not free) : LIA
/team/laser
The laser group at /tmp/lab is known as /team/laser. http://www.teamlaser.tk
Public events
- Several gamer assembly : pong game on poitiers city hall
- Several Toulouse Hacker Space Factory #THSF9
- Laser contests at Cookie demoparty
- ...
LJ
LJ is a laser framework and server for up to 4 ILDA lasers/etherdreams. You get : easy DIY plugins, alignement, monitoring,... (code and website)
Goals
The main idea is to add interactivity to "leisure" lasers. i.e with a gamepad one can play to old style vector games on city buildings. Again you must have control on anything in front of laser light. See picture at bottom.
Different levels of complexity are possible. Commercial lasers uses ilda files/connections to draw whatever you want, but you can build your own, see hardware section.
- The very fast and easy plan is to switch ilda scenes according to some inputs. You can use already made ilda files (see download section) in a SDcard plugged inside the laser fixture and use DMX protocol to switch. DMX usb cards are cheap, usually we use enttec ones. DMX controlled lasers are cheaper but quite limited to ilda files.
- If the plan is too draw live, it depends on the laser fixture DIY or commercial. Lot of possibilities depending on the number of colors, from using an arduino, a 5.1 USB soundcard, up to use commercials (opensource) cards using the standarts ilda connect ports.
- In any way, such lasers must feature X- and Y-scanners (i.e. galvanometer-moved mirrors) in order to position the beam accurately
Hardware
Obviously there is DIY Lasers and commercial ones and there is a bunch of cards integrating some DACs to talk to the laser fixture.
A great forum for bootstrap your project is laser freak that comes in different langages.
We play with two different setups :
- a green DIY laser made at la Blackboxe with a lasershark USB DAC card.
- an ilda DB25 ports RGB commercial laser for clubs with an Etherdream USB DAC card.
Commercial Lasers
Warning ! Not all lasers can draw anything ! Only the ones featuring scanners (i.e. galvanometer-moved mirrors) for the X- and Y-axes can do it (unlike the cheapest ones, which only draw random patterns).
On commercial lasers, the standard way to drive the beam is the DB25-connector-based ILDA interface (source : laserfx.com). It is based on analog differential control signals.
Therefore you'll need some external hardware capable of outputting such signals, be it standalone or controlled by a host computer. Such hardware is usually named concisely "DAC".
DIY Lasers
[1] : a DIY laser projector made from scratch.
Even the galvanometers are home-built !
In particular, there is a detailed study of the design of the galvanometers' servo loop control : galvanometers feature inertia like any mechanical devices, and achieving fast and accurate moves requires to "compensate" the galvanometers' drive signals with respect to their sensed position.
Control boxes : DAC
Lasershark
- One color only
- to be used with openlase
- USB
Ether-dream
- This is an ILDA control box which can either work as standalone (displaying a sequence of ILDA scenes tored internally or on an SD-card) or receive IP frames for driving the beam.
- RGB capable
- RJ45 : The ether dream is directly tcp/IP controlled, so you can imagine very cool projects with very easy setup and of course the programming langage you prefer.
- The firmware is open-source (but what about the hardware ?)
- In depth protocol page kind of hidden [2]
Examples
Laser Asteroids
An "Asteroids"-variant game from Brandon Thomas (Echelon) on GitHub
Laser Hexagon
Video preview here (work in progress).
For more info, see project page.
Laser Pinball
Work in progress.
2D physic for example by pymunk Laser_Pinball
Conversion from svg to ild file format
- Use inkscape to create shapes, text,..
- Use convert "object to path".
- Select on each letter, apply "simplify"
- svg2ild.py that can be found on github by marcan or search for clakoscrew.
- python svg2ild.py -q svgfile.scg ildfile.ild
Reminder :
- with "simplify", there is no "q" command in created svg path, that generate an error with svg2ild.py
- todo : debug svg2ild.py
Exporting from INKSCAPE
- Save as HPGL
- Regexp :
#!/usr/bin/python import sys import re source = sys.argv[1] content = file( source ).read() L = [] L.append([";","\n"]) L.append(["^IN",""]) L.append(["PU.*",""]) L.append(["PD",""]) for pattern, replace in L : content = re.sub( pattern, replace, content) parsed = re.split("\n", content) tmp = [] out = [] MaxX = -9999999999999999 MaxY = -9999999999999999 MinX = 999999999999999 MinY = 999999999999999 first = None for line in parsed: if line == "" : continue tup = re.split(',',line) if len(tup) < 2 : continue x = int( ( int( tup[0] )) ) y = int( ( int( tup[1] )) ) MinX = x if x < MinX else MinX MaxX = x if x > MaxX else MaxX MinY = y if y < MinY else MinY MaxY = y if y > MaxY else MaxY tmp.append([x,y]) if( first == None ): first = [x,y] tmp.append( first ) moveX = ( MaxX + MinX ) / 2 moveY = ( MaxY + MinY ) / 2 for x,y in tmp: newX = x - moveX newY = y - moveY out.append( [ newX, newY ] ) print out
- From :
IN;SP1;PU778,2039;PD841,1858;PD908,2041;PU799,1983;PD887,1982;PU;
- To :
[[[778,2039],[841,1858],[908,2041]],[[799,1983],[887,1982]]]