Guide

Overview

This plugin, superSerial, allows seamless serial communication between Grasshopper and Arduino. It facilitates sending and receiving data in various modes, enabling interactive control and feedback for Arduino-based projects. I haven’t tested it on other boards (i.e. RaspBerry) but it should work with any serial com.

Once installed (drop it on the canvas, after unblocking it, if needed), the plugin adds a new menu item called superSerial in Grasshopper. Inside this menu, there is a single component designed for serial communication. This component can operate in four different modes to handle various communication scenarios.

Grasshopper Instructions

How to Use the Component

  1. Drag and Drop the File:
    • Drag and drop the .gha file into Grasshopper.
    • A new menu item called superSerial will appear in the Grasshopper interface.
  2. Add the Component to the Canvas:
    • Open Grasshopper and navigate to the superSerial menu.
    • Drag the superSerial component onto the canvas.

It looks like this:

  • Component Inputs:
    • The component has several inputs that control its behavior:
      • Switch (ON/OFF):
        A boolean toggle that enables or disables serial communication.
        • Set to TRUE to activate communication with Arduino.
        • Set to FALSE when uploading a new script to Arduino (to free up the serial port).
      • Baud:
        The baud rate (speed of communication).
        • Default is 9600, which matches most Arduino scripts.
        • Other common options include 19200, 38400, 57600, and 115200.
        • Ensure that this matches the baud rate set in your Arduino script.
      • Port:
        The COM port used by your Arduino.
        • Check the “Available ports” message at the bottom of the component for your COM port (e.g., COM9).
        • Update this input with your specific port name.
  • Data Out:
    The data you want to send to Arduino (if applicable). For example, text commands or values.
      • Separator:
        Optional input for a separator symbol (e.g., ,, ;, or :). Leave blank if not needed.
      • Mode:
        Select one of four modes of operation:
        1. Mode 0 (Read Only): Grasshopper only reads data from Arduino.
        2. Mode 1 (Send Only): Grasshopper sends data to Arduino but does not read.
        3. Mode 2 (Read and Send): Grasshopper both reads from and sends data to Arduino.
        4. Mode 3 (Trigger Send): Grasshopper sends data to Arduino only when triggered by a boolean input.
      • Trigger:
        A boolean input used in Mode 3 to trigger data transmission.
  • Component Outputs:
    • The component provides three outputs:
      • Info (Status): Displays connection status or error messages.
      • Out (Sent): Shows the last transmitted data from Grasshopper to Arduino.
      • Read (Received): Displays incoming data from Arduino.

Arduino Instructions

How to Use with Arduino

  1. Upload one of the provided scripts based on your desired mode of operation:
    • Mode 0: Read Only
      Upload this script if you want Arduino to continuously send numbers from 1 to 100 over serial communication.
    • Mode 1: Send Only
      Use this script if you want Arduino to turn an LED on/off based on incoming serial data or blink based on specific commands like "superSerial x".
    • Mode 2: Read and Respond
      This script makes Arduino respond with "I have received (value)" whenever it receives data from Grasshopper.
    • Mode 3: Trigger Receive
      Use this script if you want Arduino to immediately flush its serial buffer after receiving any new data.
  2. Ensure that:
    • The baud rate in your Arduino script matches the baud rate set in Grasshopper’s “Baud” input.
    • The COM port selected in Grasshopper matches your Arduino’s COM port.
  3. Important Notes:
    • Set the Grasshopper component’s “Switch” input to FALSE before uploading a new script to Arduino, as an active serial connection will block uploads.
    • Once the script is uploaded, set “Switch” back to TRUE in Grasshopper to enable communication.

p.s. all the Arduino scketches are included in the zip file, food4rhino.

Modes Overview

ModeDescriptionExample Behavior
0Read Only: Arduino sends numbers from 1–100 repeatedly over serial communication.Grasshopper reads these numbers continuously.
1Send Only: Arduino turns an LED on/off based on received data or blinks for specific commands like "superSerial x".Send "superSerial 4" from Grasshopper, and Arduino blinks LED 4 times.
2Read and Send: Arduino responds with "I have received (value)" whenever it receives data.Send "Hello" from Grasshopper; Arduino replies "I have received Hello".
3Trigger Receive: Arduino processes incoming data immediately and flushes its serial buffer.Send "Data" from Grasshopper; Arduino echoes it back instantly and waits again.

Example Workflow

  1. Open Grasshopper and place the superSerial component on the canvas.
  2. Set up a toggle for “Switch” (TRUE/FALSE) and connect it to enable/disable communication.
  3. Enter your COM port (e.g., COM9) into the “Port” input.
  4. Select a mode by entering its number (0, 1, 2, or 3) into the “Mode” input.
  5. If applicable, provide additional inputs like “Data Out” or “Trigger.”

Troubleshooting

  • If you encounter issues:
    1. Ensure that your COM port is correct by checking available ports in the component’s message area.
    2. Verify that your baud rate matches between Grasshopper and Arduino.
    3. Make sure “Switch” is set to FALSE before uploading a new script to Arduino.
  • For debugging, use the “Info” output of the component to check connection status or error messages.

This plugin is still in beta, but it works and solved my issues. Let me know if you need further clarification!

Utilizzando il sito, accetti l'utilizzo dei cookie da parte nostra. maggiori informazioni

Questo sito utilizza i cookie per fornire la migliore esperienza di navigazione possibile. Continuando a utilizzare questo sito senza modificare le impostazioni dei cookie o cliccando su "Accetta" permetti il loro utilizzo.

Chiudi