Inflatable Tube Guy Concert
Blow air to inflate a mini inflatable Tube Guy to host a fun light-and-sound concert.
Components and supplies
1
LED Ring
1
Icstation Recordable Sound Module
1
Breadboard - 400 contacts
1
Resistor 330 ohm
1
Modern Device Wind Sensor Rev. P
1
Wacky Waving Inflatable Tube Guy
1
Mini breadboard - White
1
Transistor NPN (BC547 or similar)
1
1 relay module 5 Vdc 10A (assembled)
1
Arduino Nano
Tools and machines
1
Prusa i3 MK3S+
1
Soldering kit
1
Tool Kit, Crimping
Apps and platforms
1
Arduino IDE
1
Fusion 360
Project description
Code
Tube Guy Concert Code
cpp
1// C++ code 2// 3// do ring forward once, odd/even interchanges,3 flashes, ring backward end once 4 5#include <Adafruit_NeoPixel.h> 6#ifdef __AVR__ 7 #include <avr/power.h> 8#endif 9 10#define LED_PIN 9 11#define LED_COUNT 16 12 13#define analogPinForRV 1 // change to pins you the analog pins are using 14#define analogPinForTMP 0 15 16#define sound 5 17#define tube 4 18 19// to calibrate your sensor, put a glass over it, but the sensor should not be 20//// touching the desktop surface however. 21// adjust the zeroWindAdjustment until your sensor reads about zero with the glass over it. 22 23const float zeroWindAdjustment = .2; // negative numbers yield smaller wind speeds and vice versa. 24 25int TMP_Therm_ADunits; //temp termistor value from wind sensor 26float RV_Wind_ADunits; //RV output from wind sensor 27float RV_Wind_Volts; 28unsigned long lastMillis; 29int TempCtimes100; 30float zeroWind_ADunits; 31float zeroWind_volts; 32float WindSpeed_MPH; 33 34Adafruit_NeoPixel ring(LED_COUNT, LED_PIN, NEO_RGBW + NEO_KHZ800); 35 36void setup() { 37 38 #if defined (__AVR_ATtiny85__) 39 if (F_CPU == 16000000) clock_prescale_set(clock_div_1); 40 #endif 41 42 pinMode(LED_BUILTIN, OUTPUT); 43 ring.begin(); 44 ring.show(); 45 ring.setBrightness(50); 46 47 pinMode(sound, OUTPUT); 48 pinMode(tube, OUTPUT); 49 50 Serial.begin(57600); 51 Serial.println("start"); 52 53 pinMode(A2, INPUT); // GND pin 54 pinMode(A3, INPUT); // VCC pin 55 digitalWrite(A3, LOW); 56 57} 58 59void loop() 60{ 61 62wind(); 63if (WindSpeed_MPH > 10.00){ 64 concert(); 65} else { 66 digitalWrite(tube, HIGH); 67} 68 69 70 71 72 73} 74 75 76void ledShow(){ 77 on(); 78 interchange(); 79 flash(); 80 theaterChase(ring.Color(random(255), random(255), random(255)), 50); // Blue 81 flash(); 82 on(); 83 off(); 84} 85 86void on(){ 87 for(int i = 0; i < ring.numPixels(); i++){ 88 ring.setPixelColor(i, random(255), random(255), random(255), 0); 89 ring.show(); 90 delay(50); 91 } 92} 93 94void interchange(){ 95 for (int i=0;i<4;i++){ //flash 3 times 96 for(int j=0; j<16;j++){ 97 if(j%2==0){ //even 98 ring.setPixelColor(j, random(255), random(255), random(255), 0); 99 ring.show(); 100 delay(50); 101 }else{ 102 ring.setPixelColor(j, 0, 0, 0, 0); 103 ring.show(); 104 delay(50); 105 } 106 } 107 delay(10); 108 for(int j=0; j<16;j++){ 109 if(j%2==1){ //odd 110 ring.setPixelColor(j, random(255), random(255), random(255), 0); 111 ring.show(); 112 delay(50); 113 }else{ 114 ring.setPixelColor(j, 0, 0, 0, 0); 115 ring.show(); 116 delay(50); 117 } 118 } 119 delay(10); 120 } 121} 122 123void flash(){ 124 for(int i=0;i<4;i++){ //flash 3 times 125 for(int j=0;j<16;j++){ //pins on 126 ring.setPixelColor(j, random(255), random(255), random(255), 0); 127 ring.show(); 128 delay(10); 129 } 130 delay(10); 131 for(int j=0;j<16;j++){ //pins off 132 ring.setPixelColor(j, 0, 0, 0, 0); 133 ring.show(); 134 delay(10); 135 } 136 delay(10); 137 } 138 139} 140 141void theaterChase(uint32_t c, uint8_t wait) { 142 for (int j=0; j<15; j++) { //do 10 cycles of chasing 143 for (int q=0; q < 3; q++) { 144 for (uint16_t i=0; i < ring.numPixels(); i=i+3) { 145 ring.setPixelColor(i+q, c); //turn every third pixel on 146 } 147 ring.show(); 148 149 delay(wait); 150 151 for (uint16_t i=0; i < ring.numPixels(); i=i+3) { 152 ring.setPixelColor(i+q, 0); //turn every third pixel off 153 } 154 } 155 } 156} 157 158void off(){ 159 for(int i = ring.numPixels()-1; i >= 0; i--){ 160 ring.setPixelColor(i, 0, 0, 0, 0); 161 ring.show(); 162 delay(50); 163 } 164} 165 166void wind(){ 167 if (millis() - lastMillis > 200){ // read every 200 ms - printing slows this down further 168 169 TMP_Therm_ADunits = analogRead(analogPinForTMP); 170 RV_Wind_ADunits = analogRead(analogPinForRV); 171 RV_Wind_Volts = (RV_Wind_ADunits * 0.0048828125); 172 173 // these are all derived from regressions from raw data as such they depend on a lot of experimental factors 174 // such as accuracy of temp sensors, and voltage at the actual wind sensor, (wire losses) which were unaccouted for. 175 TempCtimes100 = (0.005 *((float)TMP_Therm_ADunits * (float)TMP_Therm_ADunits)) - (16.862 * (float)TMP_Therm_ADunits) + 9075.4; 176 177 zeroWind_ADunits = -0.0006*((float)TMP_Therm_ADunits * (float)TMP_Therm_ADunits) + 1.0727 * (float)TMP_Therm_ADunits + 47.172; // 13.0C 553 482.39 178 179 zeroWind_volts = (zeroWind_ADunits * 0.0048828125) - zeroWindAdjustment; 180 181 // This from a regression from data in the form of 182 // Vraw = V0 + b * WindSpeed ^ c 183 // V0 is zero wind at a particular temperature 184 // The constants b and c were determined by some Excel wrangling with the solver. 185 186 WindSpeed_MPH = pow(((RV_Wind_Volts - zeroWind_volts) /.2300) , 2.7265); 187 188 Serial.print(" WindSpeed MPH "); 189 Serial.println((float)WindSpeed_MPH); 190 lastMillis = millis(); 191 } 192} 193 194void concert(){ 195 digitalWrite(sound, HIGH); 196 digitalWrite(tube, LOW); 197 //delay(10000); 198 ledShow(); 199 digitalWrite(sound, LOW); 200}
Downloadable files
Tube Guy Case CAD
tubeguybox v4.stl
Documentation
Tube Guy Concert Project Documentation
Copy of Tube Guy Concert Project.pdf
Comments
Only logged in users can leave comments