Arduino

Arduino Inrtoduction

Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.

 


Reference

Arduino - 首页 

Archived Library Examples | Arduino Documentation

Open source

Open source software is software with source code that anyone can inspect, modify, and enhance.

“Source code” is the part of software that most computer users don’t ever see; it’s the code computer programmers can manipulate to change how a piece of software—a “program” or “application”—works. Programmers who have access to a computer program’s source code can improve that program by adding features to it or fixing parts that don’t always work correctly.

open hardware

“Open hardware,” or “open source hardware,” refers to the design specifications of a physical object which are licensed in such a way that said object can be studied, modified, created, and distributed by anyone.

Open hardware’s source code should be readily accessible, and its components are preferably easy for anyone to obtain. Essentially, open hardware eliminates common roadblocks to the design and manufacture of physical goods; it provides as many people as possible the ability to construct, remix, and share their knowledge of hardware design and function. 

Reference

  1. What is open source?
  2. What is open hardware?

Case No.1

Run water light program

To control a single LED, you only need to give the pins high and low levels to control the light on and off.

Running lights: Multiple LED lights.

Multiple pin settings need to be used, so pins 2-7 are used here.

Control the lights on and off separately to achieve the effect of running lights.

The effect of the running water lamp: the lights that are fully off are lit one by one, and then gradually extinguished to the beginning end, and the cycle can be, of course, there can be other effects, and you can set it yourself.  

Selection of input module and output module

Arduino UNO development board

6 LED lights

Dupont Lines

USB interface

Programming environment

Arduino IDE

Tinkercad diagram



The code and basic logic of the case

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
int val;
int base=2;
int num=6;
void setup()
{
for (int i=base;i<base+num;i++)
{
pinMode(i,OUTPUT);
}
}
void loop()
{
for(int i=base;i<base+num;i++)
{
digitalWrite(i,LOW);
delay(200);
}
for(int i=base;i<base+num;i++)
{
digitalWrite(i,HIGH);
delay(200);
}
}

how to upload it




Presentation of achievements

The LED lights turn on one by one and then turn off one by one



Case No.2

Use ultrasonic sensor to change the WS2812B LED Circle‘s color

In this tutorial,we are going to build a programe and learn how to use arduino to change the distance far or close to control ES2812B RGB LED cirle’s color.

These LED strips usually come with a removable tape, so that you can stick them wherever you want. The problem is that they don’t stick very well, so chances are that you’ll find your strip in the floor the following day. 

The solution: I found this strip case that diffuses the light well and you can screw it to a shelf, for example, if you want a permanent solution.

Hardware Require

1.Arduino UNO
2.Jumper wires
3.DIYables USB Cable for Arduino Uno
4.Ultrasonic sensor 
5.WS2812B RGB LED Circle 

Selection of input module and output module

Ultrasonic sensor is used to measure the distance to an object by using ultrasonic waves.This sensor reads from 2cm to 400cm (0.8inch to 157inch) with an accuracy of 0.3cm (0.1inches), which is good for most hobbyist projects. In addition, this particular module comes with ultrasonic transmitter and receiver modules. 

Tinkercad diagram

Here’s the pinout of the HC-SR04 Ultrasonic Sensor.

VCC Powers the sensor (5V)
Trig Trigger Input Pin
Echo Echo Output Pin
GND Common GND

WS2812B RGB LED Circle

Each pixel can have its own color and brightness as your wish. 

The code and basic logic of the case

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

#include <Adafruit_NeoPixel.h>
#include <Adafruit_NeoPixel.h>

#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(160, PIN, NEO_GRB + NEO_KHZ800);

int trigPin = 9; // TRIG pin
int echoPin = 8; // ECHO pin

float duration_us, distance_cm;

void setup() {
// begin serial port
Serial.begin (9600);

// configure the trigger pin to output mode
pinMode(trigPin, OUTPUT);
// configure the echo pin to input mode
pinMode(echoPin, INPUT);

strip.begin();
strip.setBrightness(15); //adjust brightness here
strip.show(); // Initialize all pixels to 'off'
}

void loop() {
// generate 10-microsecond pulse to TRIG pin
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// measure duration of pulse from ECHO pin
duration_us = pulseIn(echoPin, HIGH);

// calculate the distance
distance_cm = 0.017 * duration_us;

// print the value to Serial Monitor
if (distance_cm <=15)
colorWipe(strip.Color(255, 0, 0), 30);

Serial.print("distance: ");
Serial.print(distance_cm);
Serial.println(" cm");

if(distance_cm >=30)
colorWipe(strip.Color(0, 255, 0), 30);

Serial.print("distance: ");
Serial.print(distance_cm);
Serial.println(" cm");
}
// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
}
}

void rainbow() {
uint16_t i, j;

for(j=0; j<256; j++) {
for(i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel((i+j) & 255));
}
strip.show();
}
}

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle() {
uint16_t i, j;

for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
for(i=0; i< strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
}
strip.show();
}
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
if(WheelPos < 85) {
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
} else if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
} else {
WheelPos -= 170;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
}

Demonstration

If the hand is getting close to the  Ultrasonic sensor within the distance less than 15cm, then the light will turn into Blue. Otherwise, the light will turn into Green, and we can add more distance intervals to change the light color through chang the colorwipe.


Comparison Open Source Projects

simillar to Our Final Project

Digital Fabrication of Pneumatic Actuators with Integrated Sensing by Machine Knitting

Introduction:

Soft actuators with integrated sensing have shown utility in a variety of applications such as assistive wearables, robotics, and interactive input devices. Despite their promise, these actuators can be difficult to both design and fabricate. As a solution, we present a workflow for computationally designing and digitally fabricating soft pneumatic actuators via a machine knitting process. Machine knitting is attractive as a fabrication process because it is fast, digital (programmable), and provides access to a rich material library of functional yarns for specified mechanical behavior and integrated sensing. Our method uses elastic stitches to construct non-homogeneous knitting structures, which program the bending of actuators when inflated. Our method also integrates pressure and swept frequency capacitive sensing structures using conductive yarns. The entire knitted structure is fabricated automatically in a single machine run. We further provide a computational design interface for the user to interactively preview actuators’ quasi-static shape when authoring elastic stitches. Our sensing-integrated actuators are cost-effective, easy to design, robust to large actuation, and require minimal manual post-processing. We demonstrate five use-cases of our actuators in relevant application settings.



Smiliar with our work:

  1. Same as the project using pneumatic devices
  2. Both of them integrated with interactive input devices

 

Adventage:

  1. One notable advantage of the presented method is the ability to rapidly fabricate sensing-integrated pneumatic actuators using machine 
  2. Another advantage lies in the integration of resistive pressure sensors and swept frequency capacitive sensing electrodes. These components can be seamlessly integrated into the actuators using conductive yarns. This integration allows the sensors to remain resilient to the effects of large actuation, ensuring accurate
  3.  Additionally, the inclusion of a user-friendly design

Disadvantage/Limitation:

  1. Complex actuator/sensing design. Currently, it is challenging to incorporate our sensors over the entire body of the actuator, given the extensive stretching of the elastic yarn.
  2. Actuators of diverse shapes and sizes. As demonstrated by recent work , machine knitting is compatible with complex 3D geometry.
  3. The granularity of actuation.  The bending performance of the actuator is determined by the knitted sheath designs as well as pneumatic channel properties, e.g., wall thickness, radius, and materials. 
  4. Sensing. As one limitation, during grasping, we notice that direct contact with grasped objects mostly occurs at the fingertips, which limits the utility of our integrated sensors distributed throughout the actuators.

Reference

Digital Fabrication of Pneumatic Actuators with Integrated Sensing by Machine Knitting | Proceedings of the 2022 CHI Conference on Human Factors in Computing Systems (zju.edu.cn) 

Therms-Up!: DIY Inflatables and Interactive Materials by Upcycling Wasted Thermoplastic Bags | Proceedings of the Fifteenth International Conference on Tangible, Embedded, and Embodied Interaction (zju.edu.cn)