👾

Physical Computing: Prototyping a flower that rises

Objectives

End goal for phase 1 → make a structure that rises depending on a sensor reading.

Starting components:

  • Arduino
    • The Arduino boards have a few pins which can generate a continuous PWM signal. On the Arduino Nano 33 IoT. they’re pins 2, 3, 5, 6, 9, 10, 11, 12, A2, A3, and A5.
  • Sensor that can read movement / distance → digital input
    • Requirements:
      • Needs to be hidden in the installation - infrared?
      • Interaction starts at maximum 20’’
    • I can have 5 ToF sensors hooked up to 1 arduino at same time
  • Motor than can generate movement at different rates. Those rates should be programmatically controlled → output
    • Solenoid generates one big push → not suitable
    • Stepper motors → indicates angle at which stepper motor has been pushed
    • Servos need 1 more step so we can know the angle at which they’ve rotated.
      • 180-degree range (they make 360º or high torque)
      • 3 wires: power (usually +5V), ground, control
        • Can connect those +5V directly to a 5V power source (the Arduino’s 5V or 3.3V output will work for one servo, but not for multiple servos).
      • Digital output that can act analog - check!
    • Ultrasonic sensor - uses sound waves - noisy data
      • detects a hand better
  • Structure that will be affected physically by motor
    • How to increase the distance that will be increased?
    • Puttting a hole for a screw?
    • Rack and pinion servo.

To-do list

Understand distance sensors
Lab: I2C Communication with a Time-of-Flight Distance Sensor – ITP Physical ComputingLab: I2C Communication with a Time-of-Flight Distance Sensor – ITP Physical Computing
Read Adafruit_VL53LOX library documentation
ITP_NYU Meet the MotorsITP_NYU Meet the Motors
Analog Output – ITP Physical ComputingAnalog Output – ITP Physical Computing
(Week 3 Labs/Reading)
Lab: Servo Motor Control with an Arduino (Week 3 Labs)
Differences between motors:
DC Motors: The Basics – ITP Physical ComputingDC Motors: The Basics – ITP Physical Computing
Multiple inputs or outputs:
ITP_NYU MUXITP_NYU MUX
Resources – ITP Physical ComputingResources – ITP Physical Computing
⭐️
Robotics Weekends VL53L0X vs HC-SR04 range sensor (Part 1)Robotics Weekends VL53L0X vs HC-SR04 range sensor (Part 1)

Time of Flight Distance Sensor Lab

Datasheet linked in Lab:

www.st.com

Using Adafruit_VL53LOX library: Embed GitHubEmbed GitHub

Uses an I2C synchronous serial protocol (instead of a SPI protocol) and because of that, you only ever need 2 wires for communication to 1 or multiple devices.

You can configure whether the sensor is in high speed mode, high sensitivity mode, or long distance mode.

In the VL53LOX, the 'cone' of sensing is very narrow.

image

Working code for one sensor and one servo

Test code for 16 channel servo driver for 5 servos.

Interrupt example code to change I2C addresses

Q&A

Asynchronous serial communication vs synchronous serial communication
Would a servo motor be analog or digital output?
SDA vs SCL?
What is a linear actuator?
What is a terminal block?
When the pin is pulled low, the sensor goes into shutdown mode - pin is pulled low - what does that mean?

Next steps:

  • Draw out motor lab schematic
  • Connect digital input to digital output through Arduino
  • map values from distance sensor to motor
  • Distance sensor? Rotary Encoder
  • Do I use 5 HS318 Servos? or a stepper? Do I even need to know how far the motor has gone?
    • I also need a Adafruit PCA9685 16-channel servo driver.
    • Needs an extra step with communication
  • Hook up 5 distance sensors + 5 motors with corresponding power
    • Stepper motor vs adding extra sensor
      • alignment - get weight right
      • for speed changes, uses h bridge driver vs STEP driver- STEP + DIR
    • Ultrasonic sensor - uses sound waves - noisy data
      • Detects a hand better
    • Array of sensors with rotary encoder to detect
      • Field + Detection translation
      • Sweeping motion
  • Can I cover sensors?
    • Nope.
  • Get external power supply that will replace computer → 5V 8A ✅
  • Reach out to prof if you’re thinking about enclosures
  • Choose materials - 3D print is cool but not squishy.
    • Flower base with gear will have to be 3D print
  • Work out 3D print / design for 1 rising flower - once the motor does work
    • Think about grid of flowers. Vertical movement only.
  • Figure out if time-of-flight can or can’t be fully covered.
  • Figure out how many motors I need (Daniel Rosin’s piece uses ~800).

Conclusions:

  • 3D modelling ⇒ most useful skill, after coding.

Questions for David in office hours:

  • Sensor placement
    • Can I cover a sensor?…..
      • no + revome plastic covering
      • can screw
      • fem to fem extension cables
    • Do i need an extension cable for the distance sensors???
  • ToF distance vs rotary encoder - what?
    • 5 tofs
    • 16 channel servo driver - needs 5v power supply or micro usb charger with vin pin roun
  • Material List…
  • How can I make this board as professional as possible?
    • Enclosures?
  • Servo is having connection issues - help
  • I do want to place my Arduino in a place where i can remove it.
  • To connect 5 distance sensors, how can

October 17th, short chat with David

  • Distance sensors have a cone shaped field of view - TODO: test it out with a rolled paper to see if field of view still works.
    • Reminder to have screw holes in the distance sensor guard.
  • A 12V power supply would have definitely fried the motor driver - it’s too much - Voltage needs to be exactly right. It’s amperage that can be larger. In this case, I would need a 5V 3A power supply, where 3A is the minimum amperage to have a little margin. David gave me a 5V 8A, which will work but I still need to check with the new tiny motors.

David kindly let me borrow the following items:

  • A bunch of SG92R TowerPro Servos and SG90
    • Can I use the same protocols?
  • Motor Drive
  • Servo Extension Cables
  • 1 servo
  • Power Supply 5V 8A
  • Check more - There might have been something else from first office hour, but unlikely.
image

Connecting multiple servos and multiple distance sensors

Setting up 2 servos, motor driver plus 1 distance sensor

Macbook’s Thunderbolt 4 (USB-C) port:

  • Voltage: 5V
  • Current: Typically up to 3A (15W) per port

For the project to run:

5V 8A

Arduino’s I2C pins are:

  • SDA – A4 - use yellow color
  • SCL – A5 - use blue color. but note that documentation does it the other way around

Hitec Servo HS-318 Standard

Adafruit PCA9685 16-channel servo driver

Servo Driver can be used for LEDs as well as any other PWM-able device.

Documentation:

Adafruit Learning System Adafruit  PCA9685 16-Channel Servo DriverAdafruit Learning System Adafruit PCA9685 16-Channel Servo Driver

image
💡

Do I need a separate power source for my motors? 5V pin does not work unless something under the Arduino is soldered.

💡

Should I be using a capacitor? Yes. 470uF or more for 5 servos. n * 100uF where n is the number of servos But specifically for the PCA9685 board, I’d have to solder the capacitor.

Adafruit Learning System Working with Multiple Same Address I2C DevicesAdafruit Learning System Working with Multiple Same Address I2C Devices

If I2C devices are all the same they might be

Servos don’t need the I2C Communication lines but 16-Channel Motor driver does.

Powering Arduino via the VIN (Voltage In) pin

*Powering your board via the 3V3/5V pins is not recommended, as it can damage your board's voltage regulator.

*Vin pin does not have reverse polarity protection. Current is constrained by the regulated power supply and the onboard voltage regulator.

VIN pin can work as a voltage input for regulated external power supplies that do not use a barrel jack connector (some Arduino boards have a barrel jack connector but mine doesn’t).

docs.arduino.ccdocs.arduino.cc
- Powering Alternatives for Arduino Boards

Claude AI info: When both USB and VIN are connected, the board uses the higher voltage source. What if they’re the same?

How can I power distance sensors through the data lines of the Motor driver? Maybe I don’t need to - just to hook it up to the same power rail

OOOOH!

20 Oct 03:27 am issues log

  • Green LED on motor driver won’t turn on. There was some slight movement though.
    • Serial Monitor not printing anything.
  • My Monitor died? wtf maybe there’s few power through
  • Next steps tomorrow: need to understand with multimeter if there’s voltage or not, to see if it’s fried.
  • Library - CircuitPython library, not sure I understand whether I can access it.

Lessons:

  • CircuitPython is not needed, libraries are interchangeable.
  • Arduino is the first thing to be disconnected and last thing to be connected
  • I needed to connect Arduino to power level.

Next steps

  • The VL53L0X has a default I2C address of 0x29! You can change it, but only in software. That means you have to wire the SHUTDOWN
  • pin and hold all but one sensor in reset while you reconfigure one sensor at a time.

  • Solder capacitor to board if needed.
  • Connected 5 ToF sensors in series ✅
image

Error:

No device found on cu.Bluetooth-Incoming-Port

Issue: Device only finding bluetooth port instead of modem port, had to update firmware and reinstall boards manager.

💡

Issue: Couldn’t have external power source connected, otherwise Arduino won’t show the port.

image
💡
Goal: Kinetic Art

Milestones

  • Rack and pinion mechanism + screws & nuts
  • Changing I2C addresses for distance sensors
  • 5 servos controlled through motors
  • Figuring out how to run power without terminal block
    • Though still had port issue?
  • 3D modelling prototype and hacking together a servo holder

Issues:

  • 3D prints gone wrong - support too strong or not printed at all
  • Device not found on port - caused by external power source
    • Or ethernet / networking adjustments ?
  • Sensor not being called → extension cable not providing stable connection.

Prev Demo issues:

  • When I had motor driver connected, sensors stopped reading.
  • Extension cable not working
  • Computer not recognizing port

→ Ended up switching away from the motor drive because comunication + addressing is done differently so pulling one motor is

Next steps:

  • Fabrication:
    • Print out flower stem in 2 separate parts
    • Add felt
      • Think about sound proof material for motor sounds
    • Use smaller sized servo motors
    • keep designing grid system
  • Add library to smooth out values
  • Debug my issue with ports
  • Map and code between all 5 future motors.

For an upcoming iteration, steppers are quiet.

image
image