Grasshopper

algorithmic modeling for Rhino

Dear all,
would it be possible to connect some kind of hardware sliders to Grasshopper?
It would be so cool to adjust several sliders manually and simultaneously (and have the model update in real time of course)!

At Meek FM they've created a hardware device for controlling typographic design and sound (!)

Views: 4315

Replies to This Discussion

There was some discussion about it in the old forum too - http://groups.google.com/group/grasshopper3d/browse_thread/thread/4...
I'm pretty sure you could do it pretty quickly with a soft potentiometer like this one: http://www.adafruit.com/index.php?main_page=product_info&cPath=...
Basically, as you move your finger across the strip, it changes its resistance and ultimately the voltage which would be sent back to some sort of a micro-controller like an Arduino board. You could then use this voltage information to control anything inside Grasshopper (or externally to physical actuators). I've been playing around with this method, and the biggest hurdle (at the moment... I think I'm really close to figuring it out though) is reading the data directly into Grasshopper. There have been some methods that read sensor data into Grasshopper by first going through processing and then into Grasshopper via a UDP connection. I have a hunch (although I haven't proved it yet) that if you can read the serial data directly into Grasshopper from a VB component in GH that the data can be streamed much quicker... thus having a faster relay time. Anyway, I'll hopefully post some examples, if I can finally get it to work.
I am already doing this with a joystick. I will be posting a video later on showing an application. In the past I have also used a musical keyboard midi interface.
Bob: Yes that looks useful, if yet a little too technical for me...
Lars: I can see you suggested the exact same thing, only 7 months go!
Andy: Those things look nifty! But wouldn't the slider be reset if you remove your finger?
WT4: Sounds interesting! Show us more, please!

Thanks all of you.
Regarding hardware sliders and interfacing directly from Arduino to Grasshopper via the 'serial port' (USB) I've set up a small demo project. Inputs from Arduino control the x, y, z dimensions of a box in GH - an earth-shattering performance. Output from GH does the show-stopping 'switch the LED on/off' trick.

I've attached an image and a zip file containing the code elements along with a DLL which gets placed in the "....\Plug-ins\Grasshopper\" folder and attached as a 'referenced assembly' to the GHX file. If the path differs to mine just detach/re-attach to suit. The latter is the only way I could get the link to the port to work - might be a more elegant solution. The code is "bare-bones" - I suggest users add their own error-trapping routines - the C# source is listed in a *.doc file. Probably a simple matter to convert it to VB for those happier with that language.

Obviously you're not limited to sliders - any sensor providing variable input voltage can be used with numbers dependent on available Arduino analog input ports. See http://arduino.cc/ for alternatives. I've used an old model Arduino NG and found I needed a minimum 200ms delay for successful data transfer. This reduces to around 300-400ms per update in Rhino - not exactly 'real-time' but close enough. Users will need to optimise according to their hardware. Have fun.
Attachments:
Awesome Ritchie. Looking forward to testing it out...I also have an NG board...maybe its time I build a new one...
I tried it using arduino + processing, this connected to Grasshopper via UDP with Giulio Piacentino´s script , converting string to floats. However, as you can see in the video, the data streaming is not really good.
Ritchie´s script looks great. Connecting directly arduino to grasshopper will surely make better results. I´ll try as soon as I can!

Cheers.
Congrats Ritchie! I also just got my VB listener to work last night. I haven't had a chance to look at your code... but it will certainly be interesting to see how you came up with your solution. For mine, I had to create different cases... and feed those case numbers into the script... so if you input the number 0, you will open the port... Then feed the number 1 to get the stored values from the Arduino... and when you're done... just switch the number to 2 to close the port. I tested this with a photocell which would transfer the voltage information to GH and would then control the radius of a circle... I know it's another ground breaking example. But, I was able to read in the data at 50ms with no problem... granted... it wasn't driving anything very complicated... but it seemed to work well. I'm going to try to hook everything up to a wii remote and feed in the accelerometer data to drive different components at the same time. I will post a video soon. Congrats again.
Very fun!
Thanks a lot for all the response in this thread. I thought this was a long shot, but I can see now that you are already getting this to work. Fantastic! Thanks for sharing code + video/images. /Mårten
hello everyone!

Pretty hard for us to make it work it out.
We have a KORG MC-1 that we try to adapt to Grasshopper
this is not evident due to our lack of skills programming.
But we are enthuasiastic anyway about the activity in this forum
we'll keep on trying
but if anyone has ideas to point a direction for us
it will be wellcome

merci!

Jerohopper

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service