In this second part of the project we will remove the micro-controller from the device and replace it with an ATtiny85. Where possible we will re-use device components.
Step 1: Circuit Diagram
The pictures above represent the circuit we will create. This was originally worked out on a small breadboard. It was decided early on, to try and save the TRRS power connector to the mask, and also to re-use the button. The RESET button did not however, find it's way into the final build. It would have required another small modification of the device casing, that most probably would not have been worth the effort.
Step 2: Parts Needed
We will need to collect a few parts together in order to proceed with this modification to the device controller.
- ATtiny85-20PU, 1, Mouser, $2.14 each
- 8 pin DIP IC socket, 1, Amazon, $0.06 each
- 10K Ohm resistor, 2, Amazon, $0.04 each
- 220 Ohm resistor, 2, Amazon, $0.00 each
- 5mm LED(any color), 1, Amazon, $0.06 each
- 3P 2 position SPDT switch, 1, Amazon, $0.06 each
Total cost of the modification $2.40. Assuming thin wire, solder and electrical tape are close to hand.
Step 3: Dismantle the Device
Dismantle the device and remove the circuit board. The LCD may be put aside for another project, we will not be using it for this modification. Save the screws and the batteries, these will be used once we re-assemble the device after completing the modification.
Step 4: Cut the Circuit Board
The circuit board should be cut as shown in the photographs above. The center section, containing the micro-controller may be put to one side as it will not be required to complete this modification.
Step 5: Build the Switch and Heart Beat Indicator
Take the section containing the switch.
Build the switch circuit as shown in the circuit diagram in Step 1. The photographs above should be helpful here also.
Step 6: Build the Power Socket
Take the section containing the TRRS socket.
Follow the circuit diagram from Step 1 to connect the battery pack to the TRRS socket and the ATtiny85 micro-controller. The photographs above should be helpful here also.
Step 7: ATtiny85 As the Heart of the Project
The Attiny85 is the heart of the project. This will replace the original micro-controller circuit contained in the middle section we discarded after cutting the circuit board into three sections.
Follow the circuit layout in Step 1. Solder the connections to the 8 pin DIP IC socket. Allow enough length in the wire to put the micro-controller into the space at the foot of the device. This should be quite clear from the attached photographs.
The ATtiny85 Pin Connections
- RESET .... 10K Ohm resistor connected to pin 8(VCC), however the reset button has not been connected
- P3 ... connect to the START/MENU switch
- P4 ... not connected, future use
- GND ... connect to the negative side of the electrolytic capacitor
- P0 ... connect to the BASE(2) of the Transistor
- P1 ... connect to the anode of the Heart Beat LED
- P2 ... not connected, future use
- VCC ... connect to one of the legs of the 2 position switch
Step 8: Timer Sketch
Take the file attached and upload to the ATtiny85. The compiled HEX data is also included here, this may be uploaded to the micro-controller using any method desired. It is assumed that the reader is familiar with programming the ATtiny85 using the Arduino IDE, or other equivalent methods.
I used a USBasp with a homemade jig to program the ATtiny85 before removing and placing in the project. The supplied sketch is annotated quite well.
It is a very simple timing routine without any frills or elegance, ripe for improvement.
Step 9: Put It All Back Together
Re-assemble the device.
Cut a small hole in the controller device to allow the 2 position switch to protrude through, as shown in Part 1 of this project. The ATtiny85 should fit at the bottom of the device between the battery connectors and the TRRS socket. The photographs above should make this a little clearer. Use electrical tape to secure and electrically isolate as much of the modification as possible.
Step 10: It Works
Now plug in the mask and test the device.
Switch the device ON using the slide switch, press the center button to start a cycle. The mask should light up and the Heart Beat LED should begin to pulse. This should continue for around ten minutes. After which time the Heart Beat LED will flash, then remain ON solid. The mask will have been turned OFF.
Now just replace the batteries when they become weak. The mask should now work unrestricted for a long time.
Step 11: Conclusions and Lessons Learned
This was a very enjoyable project. This device could potentially lend itself to many project ideas. The shape of the controller fits very nicely in the hand. This could lead to a number of future projects, perhaps hand held game controllers or the like.
Without getting into a discussion on the effectiveness of the original device itself. For an initial layout of around $35, this is a very nice project starter. The price point does not prohibit dismantling or even destroying the device to create new ideas and toys.
The connections to the TRRS socket were the most difficult for some reason. I could not visualize the connections correctly and had to make a number of attempts cutting then replacing tracks before I could assign the connections.
The micro-controller sketch could be modified to allow a number of "mood pulses" as the mask is connected to a PWM(P0) pin on the ATtiny85.
Overall a very simple project modification that has provided a lot of satisfaction. This was also completed before the second controller I purchased expires. Which will provide a controller for another project idea.
In Part 3 we will look at creating a mask and controller of our own.