Slouchy board is a small 30mm x 30mm PCB (Printed Circuit Board) that uses a tilt sensor, a piezo buzzer and an ATTiny 85 to make an annoying sound when the user is slouching. The board could be attached to a users shirt or hat so that when they lean forward, the metal ball in the tilt switch rolls forward and completes the circuit. The tilt switch that we used is very noisy and can cause some coding challenges but can be made to work. A mercury switch would have been better though.
The following individual components were used for breadboarding, all of them and more can be purchased in this kit (https://amzn.to/2D8TKAm) or you could get them separately.
Arduino Uno (https://amzn.to/2ZbrDtZ)
Jumper Wires (https://amzn.to/2IvlfI2)
Resistors (1k and 10k) (https://amzn.to/2IsdHpj)
Piezo Buzzer (https://amzn.to/2IoQTH4)
Tilt Switch (https://amzn.to/2IpmVTn)
SWITCH ALTERNATIVE: Mercury switch (https://amzn.to/2IlnK0n) You can try to use this but I am not sure how it works as I haven't used one.
The following components and software were used to make the final product, note that you could skip the breadboarding phase since the circuit I will give you later does work but if you do any modifications, I recommend breadboarding first.
($35) To program the ATTiny85 you will need a USB programmer (https://amzn.to/2Iht5Wu)
($11) ATTiny + IC sockets (https://amzn.to/2G8lHJi)
($3) Piezo buzzer to solder into the board (https://amzn.to/2IffoHw)
($8) Resistors (10k required) (https://amzn.to/2IsdHpj)
($6) Tilt Switch (https://amzn.to/2IpmVTn) or ($10) Mercury switch (https://amzn.to/2IlnK0n)
($3.50) Battery holder (https://amzn.to/2UVvCeH)
($3) Batteries (https://amzn.to/2DaTjp7)
($8) Switches (https://amzn.to/2Xa1Nod)
Tools / Software
To make your boards you can go to EasyEDA and make a free account (https://easyeda.com/), boards usually cost $5 - $10 depending on how many are ordered, what color, sizing, etc...
These are the soldering stations that we use in the lab (https://amzn.to/2Za3ROD)
These are the helping hands that we use in the lab (https://amzn.to/2X6sDxu)
The cost of this project can range anywhere from $5 - $100 depending on what components and tools you already have.
Step 1: Breadboarding
As mentioned before, I would breadboard before going onto EasyEDA to order a complete board. You want to breadboard to ensure that all the components you plan on using work and your code works. Programming the ATTiny 85 over and over is extremely annoying when you have to remove it from the circuit to place in the programmer first.
I connected the tilt sensor to digital pin 1 and read that pin as an input, you will need to wire in a 10k resistor which can be seen easier in the schematic (Note that this is the schematic for EasyEDA, the slide switch does not apply to this step).
I connected the buzzer to pin 0, made it an output pin and wired in a 1k resistor although it is not required.
I have attached my Arduino code for the rest of the logic with comments to hopefully clear up any confusion. If you have any questions feel free to ask in the comments so that I or someone else can try to help you out.
Step 2: Easy EDA - Schematic
When you get EasyEDA set up, start by creating a new project and make a new schematic. You want to make sure you place all the parts and connect them as I have shown in the schematic. On the left side, you can search the various libraries for the parts required and then place them in the schematic.
If you search for the following terms, you should be able to find all the items.
AXIAL-6.5X2.3(1/4W) (Use this for the TiltSwitch Footprint)
C70376 (Battery Holder)
C92657 (Slide switch)
Once you have all the components placed, connect them to the correct pins and GDN or VCC. You connect them by using the wiring tool and placing the GND & VCC symbols.
Then once you have properly connected all the wires, you can click the convert to PCB button.
Step 3: Easy EDA - PCB Design
When you start in the PCB environment, you'll see a bunch of layers and numbers on the far right. Change your units to millimeters or whatever you want to use and change the snap size to something convenient. I made mine 10mm since I wanted my board outline at 30mm x 30mm but then changed it to 0.01mm once I started placing my components.
Start by editing the board outline layer (click the color and a pencil should appear) and then draw your board. Once you have this edit your top layer and start placing the components on the board how you want them by dragging them onto the outline. Since my board is 30mm x 30mm, the battery holder has to go on the back. You can change the layer of the component by clicking on it and changing it in the top right next to where it says layer.
Then once the components are placed, connect all blue lines with the wire tool, unless they are connected to GND or VCC. The GND and VCC connections connect directly to the board and don't need to be isolated.
Once all non-VCC and GND connections are wired together, you can use the Copper area tool to make the last connections. Do this once on the top layer and once on the bottom layer. Make sure that you change one of the copper areas to VCC in the properties tab, I usually make the top layer GND and the bottom layer VCC.
Once you have that done, the board should look complete and you can zoom in to see where GND connects to the board. At this point, you want to check for DRC Errors by refreshing the DRC Errors under the Design Manager tab on the far left. If there are no errors, you are good to go and order your board.
To order your board, click the button in the top ribbon with a G and right facing arrow to export your Gerber file. This will take you directly to where you purchase your boards, there are lots of options for different colors and finishes which will affect the price of the board, for PCB thickness, I think 1.6 is what we usually do.
Step 4: Soldering
Once your board gets to you, which usually takes about a week, you can get all your components together and solder them together. When doing this be sure that you orient in the correct way, this is important for the ATTiny 85 and the buzzer. The Tilt switch and resistor do not matter.
I find it helpful to use a rubber band to hold components in place when you are trying to solder in the legs as can be seen in the short video which covers soldering and how the board works.