To make a temperature sensing bag, you will need any kind of bag you like. I made my own bag by sewing, but you can also buy a premade one or reuse an old bag you find at home. To include the temperature sensor, you will need a CPX- a Circuit playground express. I will include the code I used in the later steps. For the CPX to work without needing to be connected to the laptop, you will also need a battery holder.
Overall this project is fairly simple, and does not require much previous experience and knowledge of both sewing and programming, and it is also very fun to make.
- a bag
- battery pack
- some sewing materials (thread, needle, pins, fabric (in case you decide to make your own bad, as did I))
Step 1: Gather All Your Materials That Were Listed Before
On the picture, you can see a battery holder, which you will need later.
Step 2: Code for the CPX
The first thing I did was make a code for the CPX. I did this using the website AdaFruit (makecode.com). The web site is very simple and easy to work with, enabling anyone to come up with cool codes. In this project, I focused on using the temperature sensor.
On the picture, you can see what my code looks like.
The way I constructed my code, is that it has two functions- when the switch is turned right and when it is turned left. The right side of the code is for when the switch is turned left. And when the switch is turned left, I programmed the CPX to show temperature. As you can see in the code, I assigned every 4 degrees Celsius (approximately) a different color, so I can see the CPX as a thermometer. Starting with purple at temperatures lower than -4˚, the colors go through blue, green, yellow, orange and red, coming to pink at temperatures higher than 28˚ and white (which is kind of impossible, as it is at temperatures higher than 100˚).
The left side of the code shows the functions of the CPX when the switch is turned right. For the right switch, I decided to program random colored lights just for fun, as an addition to the temperature showing. As seen in the image, when button A is pressed, a random number from 1-6 is chosen and that corresponds to one of five colors (I still need to add the sixth one). This way, after a short rainbow animation, I random color is chosen.
Another feature I added that is not shown in this image, is that when button B is pressed, the brightness increases by a lot (useful for bright days). To turn the brightness back down, all that is needed to do is to hold button B again for longer (about 5 seconds).
Step 3: Attach the CPX to the Bag
After you have the code downloaded and installed into the CPX (via a cable from your laptop) all that you have to do is attach the CPX to the outside of the bag.
I did this by sewing, using the most simple stitches. With a needle and a string (the color is up to you- both a color that blends in and a contrasting color- an artistic touch- work) just attach the CPX through the holes on its circumference (the outside) to any place on the bag you want. A smart place for it would be closer to the bottom of the bag, as it would be easier to attach the battery inside later ->>>
Step 4: Attach the Battery Pack Inside the Bag and Connect It to the CPX
Now all that's left to do is to attach a battery holder (pack) to the inside of the bag, so that the CPX works without having to be connected to another electronic device (like a laptop). You can just put the battery holder inside the bag, or you can make a pocket for it so that it stays in one place. Make sure it can reach the CPX!!! To do that, just take a piece of fabric, put it over the battery holder inside the bag where you want it to be and sew the edges to the bag. On the picture, you can see the way mine looks.
Then, cut a small hole, which the wire from the battery holder can fit through so that you can connect the battery holder (from inside the bag) to the CPX (on the outside of the bag).
Step 5: Enjoy the Beautiful Project When Walking Outside
Now that your project is finished, you don't have to worry about it being too hot or cold outside. Now, you will always know the temperature it is outside by looking at the colors on the CPX, and also have a fun color animation to lighten up your day.
To turn on the CPX, just turn on the battery holder and to turn it off, turn the battery holder off.
And now just enjoy the fun project!!!