wws
May 7, 2023, 6:57am
#1
Hi all,
What is the simplest way to hook up a sensor like a light meter or motion detector to a MacBook and read (polling) that data in SuperCollider?
I would like to avoid soldering, building custom stuff if possible. Happiest y to buy something and plug it into the usb port. …
I am also wondering if I could read data using the /dev directory given that the OS is unix underneath the pretty.
Thanks!
prko
May 7, 2023, 10:21am
#2
I used one of the following products:
1 Like
If by any chance you happen to be measuring people, I cannot recommend Google’s mediapipe enough - here is an article talking about it - Create your own depth measuring tool with MediaPipe FaceMesh in Javascript | by Susanne Thierfelder | Medium . It just uses a webcam.
You’d probably want to do it in python then send the data to supercollider using OSC.
Providing you have a well lit image, it is stupidly accurate, to the point where you can respond to the raising of an eyebrow from over 10m away with acceptable latency.
wws
May 7, 2023, 8:05pm
#4
Thanks!
Was the part usb powered, like could you just plug it and go?
Also how did s you access the data inside supercollider?
Thanks!
Maybe interesting for you (it did involve some DIY, minimal soldering was required to make it easy to connect cables to the arduino): I’ve attached 16 light dependent resistors to an arduino and used them to control supercollider.
prko
May 7, 2023, 11:41pm
#6
Yes!
I cannot remember it exactly. Anyway, I used it on Raspberry Pi 3 and 4 as follows:
Dear users,
From a USB proximity sensor (MB1403 HRUSB-MaxSonar-EZ0 | ),
SerialPort in SC receives the following ASCII numbers:
-> 82
-> 48
-> 51
-> 48
-> 48
-> 13
The first and the last number is fixed, and the others are variable from 48 to 57.
I only need the values from the second one to the fifth one.
Converting these series with Code I
~port = SerialPort( "/dev/ttyUSB0", baudrate: 57600, databits: 8, stopbit: 1, parity: 0 );
fork{ 4.do { var received = 6.collect{~port.next.asAscii}; …