top of page
43626192_715119782183154_563121016385254
ezgif.com-video-to-gif.gif

Sketch:

Lighting Aesthetics:

Process Images:

Covering the strips with the felt and placing on the shirt before sewing them on.

IMG_9264.JPG

Wiring

Testing

Schematic:

Survival Hugging T-Shirt

Overall:

There is a saying by Virginia Satir, a respected family therapist, “We need four hugs a day for survival. We need eight hugs a day for maintenance. We need twelve hugs a day for growth.” This Survival Hugging T-Shirt can provide attention through lights in different colours. It is able to count the hugs from 0 to 4 hugs using an IR proximity sensor.

Introduction of Physical Computing class project

​

Designed, programmed, made by

Meng-Han (Mohan) Yeh

Code:

  1. /*

  2. Project Title: Survival Hugging T-Shirt

  3. Name: Meng-Han Yeh

  4. Description: Control the 4 LED strips with the IR proximity sensor.

  5. ​

  6. Pin Mapping:

  7. Digital Pin 12 is connecting to Red Strip and controlling the Blue light;

  8. Digital Pin 11 is connecting to Blue Strip and controlling the Yellow light;

  9. Digital Pin 10 is connecting to Yellow Strip and controlling the Purple light;

  10. Digital Pin 8 is connecting to Purple Strip and controlling the Red light;

  11. Analog Input 0 (A0) is reading the IR proximity sensor.

  12. Coding Credit: LedStripColorTester - for LED strips colour changing

  13. ​

  14. */

  15. ​

  16. ​

  17. int photocell = A0; // A0 is reading the IR proximity sensor

  18. bool everHugged = false;

  19. unsigned long timer = 0; // set up the timer

  20. ​

  21. int hugCount = 0;

  22. ​

  23. #include <PololuLedStrip.h>

  24. ​

  25. /* Create names for each of the LED strips and set up the digital pins:

  26. Digital Pin 12 = ledStrip (the outer LED strip) is connecting to Red Strip and controlling the Blue light;

  27. Digital Pin 11 = ledStrip2 (the second LED strip from outside) is connecting to Blue Strip and controlling the Yellow light;

  28. Digital Pin 10 = ledStrip3 (the third LED strip from outside) is connecting to Yellow Strip and controlling the Purple light;

  29. Digital Pin 8 = ledStrip4 (the forth LED strip from outside, the central inside heart) is connecting to Purple Strip and controlling the Red light

  30. */

  31. ​

  32. PololuLedStrip<12> ledStrip; // the biggest heart

  33. PololuLedStrip<11> ledStrip2;

  34. PololuLedStrip<10> ledStrip3;

  35. PololuLedStrip<8> ledStrip4; // the smallest heart

  36. ​

  37. // set up how many LEDs on the strip you would like to control

  38. #define LED_COUNT 60

  39. rgb_color colors[LED_COUNT];

  40. ​

  41. void setup()

  42. {

  43. pinMode(photocell, INPUT); // set up the IR proximity sensor

  44. Serial.begin(115200); // set up the Serial Monitor

  45. ​

  46. }

  47. ​

  48. void loop() {

  49. ​

  50. int readVal; // initialize a new integer to store the photocell value

  51. readVal = analogRead(photocell); // do the analog read and store the value

  52. ​

  53. ​

  54. rgb_color color;

  55. ​

  56. // if (it has been at least 10 seconds since the last hug)

  57. if (millis() >= 10000 + timer) {

  58. if (readVal > 500) { // if the sensor detects the volumne above 500

  59. timer = millis();

  60. hugCount++; // the hugCount will plus one when the sensor detects the volumn above 500

  61. Serial.println (hugCount); // Showing the hugCount in Serial Monitor

  62. ​

  63. }

  64. }

  65. ​

  66. // if (hugCount == 0) => the beginning setting

  67. if (hugCount == 0) {

  68. ​

  69. // ledStrip => blue light

  70. color.red = 51;

  71. color.green = 255;

  72. color.blue = 255;

  73. for (uint16_t i = 0; i < LED_COUNT; i++)

  74. {

  75. colors[i] = color;

  76. }

  77. ledStrip.write(colors, LED_COUNT);

  78. ​

  79. // ledStrip2 => yellow light

  80. color.red = 255;

  81. color.green = 255;

  82. color.blue = 0;

  83. for (uint16_t i = 0; i < LED_COUNT; i++)

  84. {

  85. colors[i] = color;

  86. }

  87. ledStrip2.write(colors, LED_COUNT);

  88. ​

  89. // ledStrip3 => purple light

  90. color.red = 255;

  91. color.green = 0;

  92. color.blue = 204;

  93. for (uint16_t i = 0; i < LED_COUNT; i++)

  94. {

  95. colors[i] = color;

  96. }

  97. ledStrip3.write(colors, LED_COUNT);

  98. ​

  99. // ledStrip4 => red light

  100. color.red = 255;

  101. color.green = 0;

  102. color.blue = 0;

  103. for (uint16_t i = 0; i < LED_COUNT; i++)

  104. {

  105. colors[i] = color;

  106. }

  107. ledStrip4.write(colors, LED_COUNT);

  108. ​

  109. }

  110. ​

  111. // if (hugCount == 1) => first hug

  112. else if (hugCount == 1) {

  113. ​

  114. // ledStrip => turns off

  115. color.red = 0;

  116. color.green = 0;

  117. color.blue = 0;

  118. for (uint16_t i = 0; i < LED_COUNT; i++)

  119. {

  120. colors[i] = color;

  121. }

  122. ledStrip.write(colors, LED_COUNT);

  123. ​

  124. // ledStrip2 => yellow light

  125. color.red = 255;

  126. color.green = 255;

  127. color.blue = 0;

  128. for (uint16_t i = 0; i < LED_COUNT; i++)

  129. {

  130. colors[i] = color;

  131. }

  132. ledStrip2.write(colors, LED_COUNT);

  133. ​

  134. // ledStrip3 => purple light

  135. color.red = 255;

  136. color.green = 0;

  137. color.blue = 204;

  138. for (uint16_t i = 0; i < LED_COUNT; i++)

  139. {

  140. colors[i] = color;

  141. }

  142. ledStrip3.write(colors, LED_COUNT);

  143. ​

  144. // ledStrip4 => red light

  145. color.red = 255;

  146. color.green = 0;

  147. color.blue = 0;

  148. for (uint16_t i = 0; i < LED_COUNT; i++)

  149. {

  150. colors[i] = color;

  151. }

  152. ledStrip4.write(colors, LED_COUNT);

  153. ​

  154. }

  155. ​

  156. // if (hugCount == 2) => second hug

  157. else if (hugCount == 2) {

  158. ​

  159. // ledStrip => turns off

  160. color.red = 0;

  161. color.green = 0;

  162. color.blue = 0;

  163. for (uint16_t i = 0; i < LED_COUNT; i++)

  164. {

  165. colors[i] = color;

  166. }

  167. ledStrip.write(colors, LED_COUNT);

  168. ​

  169. // ledStrip2 => turns off

  170. color.red = 0;

  171. color.green = 0;

  172. color.blue = 0;

  173. for (uint16_t i = 0; i < LED_COUNT; i++)

  174. {

  175. colors[i] = color;

  176. }

  177. ledStrip2.write(colors, LED_COUNT);

  178. ​

  179. // ledStrip3 => purple light

  180. color.red = 255;

  181. color.green = 0;

  182. color.blue = 204;

  183. for (uint16_t i = 0; i < LED_COUNT; i++)

  184. {

  185. colors[i] = color;

  186. }

  187. ledStrip3.write(colors, LED_COUNT);

  188. ​

  189. // ledStrip4 => red light

  190. color.red = 255;

  191. color.green = 0;

  192. color.blue = 0;

  193. for (uint16_t i = 0; i < LED_COUNT; i++)

  194. {

  195. colors[i] = color;

  196. }

  197. ledStrip4.write(colors, LED_COUNT);

  198. ​

  199. ​

  200. }

  201. ​

  202. ​

  203. // if (hugCount == 3) => third hug

  204. else if (hugCount == 3) {

  205. ​

  206. // ledStrip => turns off

  207. color.red = 0;

  208. color.green = 0;

  209. color.blue = 0;

  210. for (uint16_t i = 0; i < LED_COUNT; i++)

  211. {

  212. colors[i] = color;

  213. }

  214. ledStrip.write(colors, LED_COUNT);

  215. ​

  216. // ledStrip2 => turns off

  217. color.red = 0;

  218. color.green = 0;

  219. color.blue = 0;

  220. for (uint16_t i = 0; i < LED_COUNT; i++)

  221. {

  222. colors[i] = color;

  223. }

  224. ledStrip2.write(colors, LED_COUNT);

  225. ​

  226. // ledStrip3 => turns off

  227. color.red = 0;

  228. color.green = 0;

  229. color.blue = 0;

  230. for (uint16_t i = 0; i < LED_COUNT; i++)

  231. {

  232. colors[i] = color;

  233. }

  234. ledStrip3.write(colors, LED_COUNT);

  235. ​

  236. // ledStrip4 => red light

  237. color.red = 255;

  238. color.green = 0;

  239. color.blue = 0;

  240. for (uint16_t i = 0; i < LED_COUNT; i++)

  241. {

  242. colors[i] = color;

  243. }

  244. ledStrip4.write(colors, LED_COUNT);

  245. ​

  246. }

  247. ​

  248. // if (the sensor detects more than 3 hugs), all lights turn off

  249. else {

  250. ​

  251. color.red = 0;

  252. color.green = 0;

  253. color.blue = 0;

  254. for (uint16_t i = 0; i < LED_COUNT; i++)

  255. {

  256. colors[i] = color;

  257. }

  258. ledStrip.write(colors, LED_COUNT);

  259. ​

  260. color.red = 0;

  261. color.green = 0;

  262. color.blue = 0;

  263. for (uint16_t i = 0; i < LED_COUNT; i++)

  264. {

  265. colors[i] = color;

  266. }

  267. ledStrip2.write(colors, LED_COUNT);

  268. ​

  269. color.red = 0;

  270. color.green = 0;

  271. color.blue = 0;

  272. for (uint16_t i = 0; i < LED_COUNT; i++)

  273. {

  274. colors[i] = color;

  275. }

  276. ledStrip3.write(colors, LED_COUNT);

  277. ​

  278. color.red = 0;

  279. color.green = 0;

  280. color.blue = 0;

  281. for (uint16_t i = 0; i < LED_COUNT; i++)

  282. {

  283. colors[i] = color;

  284. }

  285. ledStrip4.write(colors, LED_COUNT);

  286. ​

  287. }

  288. ​

  289. ​

  290. // Update the colors buffer

  291. for (uint16_t i = 0; i < LED_COUNT; i++)

  292. {

  293. colors[i] = color;

  294. }

  295. ​

  296. ​

  297. }

bottom of page