Cardbox Prototype

Your Image Description
Image 1
Image 2

I created this prototype in 3 hours and 15 minutes. I took a lot of time due to limited skills in knowing how to stick cardbox iwth masking tape or any tape for that matter.

What I concluded and understood by making this prototype:

  • While explaining my project and the role of each components in my device, I undrstood that TEG is not my best option due to my limited knowledge in the functionality of TEG. Even during researching about the component there was no proof of how TEG is worthy of the role in my project.
  • Focus on specifics! I came to conclude that I didnt have much idea of any of the components in my device nor the specifications of each component. I concluded that I needed to do more research on my project and the components and how sure I am that those compoents will work and the pinout of the componets I need to use.
  • Start researching and the designing the fan blade of the prayer wheel and the base of the whole structure since the base is going to be opeable and also be able to hold the whole structure in place.
  • What I learned about the size of my project

    What I originally decided for my project was way too small since I designed in "mm", without considering how small it would be. So I decided to make the size a little bigger but not more than 50cm.

    Changes I decided to make after the prototype

  • Changed the plan of using TEG I decided to use a NTC thermistor module insteaad of a TEG.SO, what is a NTC Thermistor? NTC Thermistor temperature sensor module is low cost, small size module. It is very sensitive to ambient temperature. It is generally used to detect the temperature of the surrounding environment. NTC thermistor is mainly used as a sensor and it met all the requirements of a temperature sensor in my project. It was also able to detect differences in temeprature in the simulation I made in Wokwi.
  • Process of the simulation of the components
  • Image 1
    Image 2

    But there were limited components in wokwi. I had to use a micro SD card to depict a sound module. But luckily they had the exact same NTC Thermistor module I wanted.

    Simulation of components

    Your Image Description

    But it was able to show a simulation of what I wanted the LCD and the NTC thermoistor module to do.

    Circuit drawing

    Image 1
    Image 2

    What I am currently working on

    I have started planning and did the circuit drawing for my Final Project board.

    Your Image Description

    Updates by Week 8 (Electronics Design)

  • Created a possible final project board (Will be making the design again with lesser 0 ohm resistor and a better PCB design )
  • Electronics design

    I deisgned the PCB using the basic circuit of a ATtiny44(from the fab academy site) and the sketch I worked on with Sir Rico a week back as a reference.

    Image 1
    Image 2

    Schematic design(I will be making it with lesser 0 ohm resistor the coming week)

    Image 1
    Image 2

    PCB(I will be making it better and with lesser and better connection next week.)

    Your Image Description

    Programming

    Image 1
    Image 2
    Your Image Description

    Changes I will be making with the board from next week

    • I will be redesigning the PCB with lesser 0 Ohms
    • Solder the pin header for the LCD with the other components for week 9(output devices)
    • Finalize on how I will be powering my board

    Updates by Week 9 (Output devices)

  • Updated components list, changed component for playing prayers and push button, and redesigned circuit board.
  • I changed my plan of using the ISD1820 voice recorder and player because my instructor suggested to explore on something else since the part of recording the prayer wasn't much of a use. I looked into different components for audio players which were not very big in size. I came across this guy on youtube who uses a DF Player. I got intrigued and explored on it. I concluded that the DF player was a much better option because this product is not only affordable but also incredibly user-friendly, making it very easy to use and operate. The use of the audio player and the sound box in my project is simply to play prayers when triggered by the NTC thermistor module which I am not sure if it can be triggered to play audio. But if it does not work, I will simply decide on simplifying my project and installing an extra button to play the prayer.

    DF player and the sound box

    Image 1
    Image 2

    This is the diagram that helped me make the connection for the DF player in my board. I checked the pinouts of the arduino nano and the attiny44 and checked which pin on the arduino nano it was connected to and tried corresponding it to my attiny44.

    Your Image Description

    I designed the schematic and the PCB for the DF player accordingly after deleting the symbol for the pinheader for the ISD1820 voice recorder and player.

    Image 1
    Image 2

    Redesigned Schematic and PCB

    Your Image Description
    Your Image Description

    Components not finalized list

    Component Inventory(not finalized list)
    NTC Thermistor module 1 NTC Thermistor module Operating voltage : 3.3V - 5V
    DF player 1 DF player Operating voltage : 3.3V - 5V
    Sound box 1 Sound box
    LCD display screen with I2C module 1 LCD display screen Operating voltage : 5V
    Button 4 (but one pack of this) Button Operating voltage : 3V - 12V
    ATtiny44 1 Datasheet Operating voltage : 2.7V - 5.5V
    Resistors 2 1K
    Resistors 1 680 ohm
    Resistors 6 0 ohm

    Printed the board

    Your Image Description

    Finished soldering

    Your Image Description

    Testing

    I tested the board to see if it was working, I uploaded the button code

    But..

    but unfortunately when I was connecting the LCD to my board, I noticed I had no SCL pin my connector. And also when I was testing all the buttons, one of the buttons didn't work. So, I had to redesign it again.

    Image 1
    Image 2

    After updates

    Image 1
    Image 2

    After printing

    Your Image Description
    Your Image Description

    I tried programming an LCD I2C and it worked!

    A big change of plans

    I simplified my final project, I decided not to use buttons and the LCD screen since it serves no use for now. But in the future I can plan to enhance my final project. I chose not to use the buttons because there was no use recording the brun timer and storing it. And since I won't be needing the timer for anything having a LCD display is also useless. But since my project requires a input and output device, having a NTC thermistor sensor and the DF player is enough.

    Components finalized list

    Component Inventory(finalized list)
    NTC Thermistor module 1 NTC Thermistor module Operating voltage : 3.3V - 5V
    DF player 1 DF player Operating voltage : 3.3V - 5V
    Sound box 1 Sound box
    ATtiny44 1 Datasheet Operating voltage : 2.7V - 5.5V
    Float glass 1 Float 3mm-float-glass-22432907530 4 feet by 7 feet (3mm), needed is 6 numbers of 23x13x3 glass

    Final Project Sprint

    Updates and progress by May 20th

    This is my plan(Thank you Sir Rico for helping me and making my mind more aligned with my final project)

    Your Image Description

    After the last update on my final project, I decided to start deisgning my first iteration of my enclosure and to test the components with my board and with arduino to understand better.

    Enclosure

    This is not my final design for my enclosure, but an iteration.

    Here are some shots of how it currently looks like
    Image 1
    Image 2

    This is where I plan to add the NTC thermistor module.

    Image 1
    Image 2

    The first image below is where I plan to keep my circuit board, DF player and my speaker with the resonance chamber. Which will be in the base. The second image is the press fits I encoporated in my design that I learned in week 2. I have it in the structure which will have my glass.

    Image 1
    Image 2

    This is the weirdest idea I have ever had, to join the two parts of the structure that will hold the glass, I have added another pressfit which looks a bit round. I plan to color it to depict a prayer wheel. So, there will be mini prayer wheels as the connectors between the two separate structures that are suppose to be one structure butfor my own convinience I divided it into two sections. I am not sure I f I will keep this idea.

    Your Image Description

    Overall I am not satisfied with my enclosure design which I would like to focus more.

    Electronics and Programming

    What I tried doing in the Electronics and the Programming section is trying out the components I have like, DF player, Speaker and NTC thermistor module with Arduino UNO first and then with my final project board.

    NTC thermistor module

    What I tried with the NTC thermistor module is to sense temperature of the butterlamp, set a threshold and when it exceeds the threshold, display "threshold exceeded, powering DF player". My idea for my final project is to sense a strike in the temperature when I put the butterlamp in the glass structure, like exceed the threshold(for testing I set it to 35) and then trigger the DF player to start praying prayers.

    Code

    
    #include <math.h>
    
    #define SENSORPIN A5  // Analog pin connected to the analog output of the LM393 module
    #define THRESHOLD_TEMPERATURE 35 // Temperature threshold in Celsius
    
    void setup() {
      Serial.begin(115200);
      pinMode(SENSORPIN, INPUT);
    }
    
    float readTemperature() {
      int analogValue = analogRead(SENSORPIN);
      float voltage = analogValue * (5.0 / 1023.0);
    
      // Assuming a 10k NTC thermistor with a 10k resistor in a voltage divider configuration.
      float resistance = (10000.0 * voltage) / (5.0 - voltage);
    
      // Convert the resistance to temperature using the Steinhart-Hart equation
      float temperature = 1.0 / (0.001129148 + (0.000234125 * log(resistance)) + (0.0000000876741 * log(resistance) * log(resistance) * log(resistance)));
      temperature = temperature - 273.15; // Convert Kelvin to Celsius
    
      return temperature;
    }
    
    void loop() {
      float temperature = readTemperature();
      Serial.print("Temperature: ");
      Serial.print(temperature);
      Serial.println(" °C");
    
      if (temperature > THRESHOLD_TEMPERATURE) {
        Serial.println("Threshold exceeded, powering DFPlayer...");
      }
    
      delay(1000); // Wait for 1 second before reading again
    }
    

    The code is from Source which I asked chagpt to modify to my liking

    Well it successfully worked and fulfilled my hopes for the outcome.And I concluded that my thermistor should be placed approximately 11cm above the flame of the butterlamp.

    but while trying it on my final project board, the real horror came upon me!

    Your Image Description

    Image source

    While uploading the code, an error like the above showed up. My sketch was too big for my MCU(ATtiny44). Thats when I decided for a big change!

    Change my MCU to XIAOESP32C3

    And it was all because, my NTC thermistor code was too big for my MCU and if my NTC thermistor code is too big, how can I be sure, I can program and power, my DF player, Speaker and Ntc thermistor module with the ATtiny44. XIAOESP32C3 recommended by Sir Rico seemed the best choice for my project and a very good idea if I have developmental plans for my Final project in the future.

    After deciding, to continue with my schedule, I decided to test the components I had with the Arduino UNO and test potential codes to fit the needs for my final project.

    DF player and Speaker

    Code

    
    #include "SoftwareSerial.h"
    #include "DFRobotDFPlayerMini.h"
    
    
    // Use pins 2 and 3 to communicate with DFPlayer Mini
    static const uint8_t PIN_MP3_TX = 2; // Connects to module's RX
    static const uint8_t PIN_MP3_RX = 3; // Connects to module's TX
    SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);
    
    
    // Create the Player object
    DFRobotDFPlayerMini player;
    
    
    void setup() {
    
    
      // Init USB serial port for debugging
      Serial.begin(9600);
      // Init serial port for DFPlayer Mini
      softwareSerial.begin(9600);
    
    
      // Start communication with DFPlayer Mini
      if (player.begin(softwareSerial)) {
       Serial.println("OK");
    
    
        // Set volume to maximum (0 to 30).
        player.volume(20);
        player.play(1);
     
      } else {
        Serial.println("Connecting to DFPlayer Mini failed!");
      }
    }
    
    
    void loop() {
    
    
       }
    

    The above code is from source,a youtube video I watched to make the connections right.

    As shown in the two videos above, Though it successfully played the prayers, it sounded like a robot chanting them. It sounded very rough and not pleasant.

    For which I added a resistor between the RX of the DF player and the D3 of the Arduino and

    TADAAAA!

    No more buiwebvuiwbwjvbjskvbwuivbsuivbuvbjbjksvbisvbisu with the prayers!

    What I concluded on what I have progressed till now, I shall redesign my enclosure make it more appealing and WOW!, also make it more enjoyable to use and aesthetically pleasing to look at. And make it more smart. And on my electronics and programming section, I have decided to add a volume controller with either a Potentiometer or a Button. Not decided but will make progress. And of course change my board to XIAOESP32C3.

    Updates on Enclosure

    Image 1 Image 2 Image 3

    This is what I concluded on, I thank my friends, my instructors, Sir Anith and Sir Rico for helping me all through my joruney till now.

    Image 1
    Image 2

    New Enclosure

    Structure for ntc and prayer wheel pivot

    Image 1
    Image 2

    The structure acts as a 2nd piece for the glass structure since it is also a lid. The structure contains two parts one hollow block which holds the NTC thermistore module, and the other which goes below the hollow block only allowing the thermistor to be out in the heat. I have also added an adjustable feature to adjust when the thermistor is far away or very close. It allows users to add different sizes of butterlamp and adjust the placement for the NTC thermistor module. For now it only has 3 options to adjust to. There is also a place for the wires beside the thermistor and through the glass structure, allowing a very neat and organized finish product. I have decided to 3D print it for now but it will be certain when I test it with a real butterlampand confirm its fire resistance.

    NTC holder

    Your Image Description

    The NTC holder is a pressfit design which allows users to adjust the placement of the NTC thermistor module with 3 slots to add a piece of rubber to strengthen the slot the user chose. I decided to add an adjustable feature here after a feedback on having the NTC thermistor's placing adjustable with the size of the butter placed.I discovered that it is essential that I place the NTC thermistor module not too close or too far and with progress in my final project I have learned that I should place it 11 cm away from the flame. I have decided to 3D printing it for now but I will only be certain when I test it with a butterlamp placed below to check its fire resistance.

    Hinge

    Your Image Description

    This is a hinge I designed during week 3. I chose this because it is a very simple design, it can be screwed easily, it works and most importantly, I learned how to design it. I will be 3D printing it.

    Base

    Your Image Description

    My base is hollow, to place my circuit board, DF player and my speaker with its resonance chamber. I have decided to either laser printing it or using the CNC machine. I will be adding a feature similiar to the battery boxof a toy.

    Glass structure case

    Your Image Description
    Image 1
    Image 2

    To place the glasses in the struture I have decided to make slots with the dimensions of the glass I am planning on using. I will also be using a pressfit feature to fix it to the base. I will be using the laser printer to print in batches and stick them together.

    Labelled diagram on how each component is going to be fabricated

    Your Image Description

    Fabricating hinge and a NTC thermistor module holder

    Your Image Description
    Image 1
    Image 2

    I printed the ntc holder before I decided it was going to be adjustable. But indeed it was a good choice.

    I printed my hinges as well to actually confirm whether it will work or I will have to design something else. But it works!

    3D Printed components

    This is the base that will house my boards and electronic parts.

    Your Image Description
    Your Image Description

    For the NTC Thermistor module, I decided to create holders for it right above the butterlamp.

    Your Image Description

    This structure is what holds the NTC Thermistor module in place

    Your Image Description
    Your Image Description
    Your Image Description

    This is my glass enclosure holder

    Your Image Description

    This is the full fabricated enclosure. I AM PROUD OF IT!

    Your Image Description
    Your Image Description
    Your Image Description

    This is a new editon to my design for convinience, it is a button holder in the front

    Your Image Description

    This video shows all the iterations of my 3D printed components

    Lasercut Components

    Your Image Description
    Your Image Description
    Your Image Description

    Electronics and Programming

    Schmatics and PCB

    Initial Final project board with the MCU

    Your Image Description
    Your Image Description

    Dfplayer board

    Your Image Description
    Your Image Description

    Button Board

    Your Image Description
    Your Image Description

    Milling the boards

    Your Image Description
    Your Image Description

    Programming

    Code

    The code below is chatgpt generated and I have used the prompt showed below.

    User:

    Write an Arduino sketch to read temperature from an NTC thermistor connected to an analog pin (A0) and control the volume of a DFPlayer Mini module based on the temperature reading. The sketch should:

    • Use the DFRobotDFPlayerMini library to communicate with the DFPlayer Mini.
    • Play audio when the temperature exceeds a defined threshold (e.g., 25°C).
    • Stop audio when the temperature drops below the threshold.
    • Allow volume adjustment via two buttons: one to increase volume (connected to digital pin 1) and another to decrease volume (connected to digital pin 2), with debounce handling.
    • Print the temperature readings and volume changes to the Serial Monitor.
    • Include necessary initialization and pin configurations.

    ChatGPT:

    "The response was,"The following code""

    #include 
    	#include 
    	#include "DFRobotDFPlayerMini.h"
    	
    	
    	#define SENSORPIN A0                    // Analog pin connected to the analog output of the LM393 module
    	#define VOLUME_UP_BUTTON_PIN 1        // Button to increase volume connected to IO1
    	#define VOLUME_DOWN_BUTTON_PIN 2     // Button to decrease volume connected to IO2
    	#define THRESHOLD_TEMPERATURE 25       // Temperature threshold in Celsius
    	#define DEBOUNCE_DELAY 50               // Debounce delay in milliseconds
    	#define AUDIO_DELAY 500                 // Delay after starting audio playback in milliseconds
    	
    	
    	HardwareSerial MySerial0(0);
    	DFRobotDFPlayerMini myDFPlayer;
    	
    	
    	void printDetail(uint8_t type, int value);
    	
    	
    	void setup() {
    	  delay(5000); // Delay for 5 seconds to allow time for initialization
    	  MySerial0.begin(9600, SERIAL_8N1, -1, -1); // TX=7, RX=8
    	  Serial.begin(115200);
    	
    	
    	  Serial.println();
    	  Serial.println(F("DFRobot DFPlayer Mini Demo"));
    	  Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
    	
    	
    	  pinMode(VOLUME_UP_BUTTON_PIN, INPUT_PULLUP);
    	  pinMode(VOLUME_DOWN_BUTTON_PIN, INPUT_PULLUP);
    	
    	
    	  if (!myDFPlayer.begin(MySerial0)) {
    		Serial.println(F("Unable to begin:"));
    		Serial.println(F("1. Please recheck the connection!"));
    		Serial.println(F("2. Please insert the SD card!"));
    		while (true); // Infinite loop if initialization fails
    	  }
    	  Serial.println(F("DFPlayer Mini online."));
    	
    	
    	  myDFPlayer.volume(20);  // Set volume value. From 0 to 30
    	}
    	
    	
    	float readTemperature() {
    	  int analogValue = analogRead(SENSORPIN);
    	  float voltage = analogValue * (3.3 / 4095.0);
    	
    	
    	  // Assuming a 10k NTC thermistor with a 10k resistor in a voltage divider configuration.
    	  float resistance = (10000.0 * voltage) / (3.3 - voltage);
    	
    	
    	  // Convert the resistance to temperature using the Steinhart-Hart equation
    	  float temperature = 1.0 / (0.001129148 + (0.000234125 * log(resistance)) + (0.0000000876741 * log(resistance) * log(resistance) * log(resistance)));
    	  temperature = temperature - 273.15; // Convert Kelvin to Celsius
    	
    	
    	  return temperature;
    	}
    	
    	
    	void loop() {
    	  static bool volumeUpButtonPressed = false;
    	  static bool volumeDownButtonPressed = false;
    	  static bool audioPlaying = false;
    	
    	
    	  float temperature = readTemperature();
    	  Serial.print("Temperature: ");
    	  Serial.print(temperature);
    	  Serial.println(" °C");
    	
    	
    	  if (temperature > THRESHOLD_TEMPERATURE && !audioPlaying) {
    		Serial.println("Threshold exceeded");
    		myDFPlayer.play(); // Start playing
    		audioPlaying = true;
    		delay(AUDIO_DELAY); // Delay after starting audio playback
    	  } else if (temperature <= THRESHOLD_TEMPERATURE && audioPlaying) {
    		Serial.println("Threshold not exceeded");
    		myDFPlayer.stop(); // Stop playing
    		audioPlaying = false;
    	  }
    	
    	
    	  if (digitalRead(VOLUME_UP_BUTTON_PIN) == LOW && !volumeUpButtonPressed) {
    		delay(DEBOUNCE_DELAY); // Debounce delay
    		if (digitalRead(VOLUME_UP_BUTTON_PIN) == LOW) {
    		  int currentVolume = myDFPlayer.readVolume();
    		  if (currentVolume < 30) {
    			myDFPlayer.volume(currentVolume + 1);
    			Serial.print(F("Volume increased to "));
    			Serial.println(currentVolume + 1);
    		  }
    		  volumeUpButtonPressed = true;
    		}
    	  } else if (digitalRead(VOLUME_UP_BUTTON_PIN) == HIGH) {
    		volumeUpButtonPressed = false;
    	  }
    	
    	
    	  if (digitalRead(VOLUME_DOWN_BUTTON_PIN) == LOW && !volumeDownButtonPressed) {
    		delay(DEBOUNCE_DELAY); // Debounce delay
    		if (digitalRead(VOLUME_DOWN_BUTTON_PIN) == LOW) {
    		  int currentVolume = myDFPlayer.readVolume();
    		  if (currentVolume > 0) {
    			myDFPlayer.volume(currentVolume - 1);
    			Serial.print(F("Volume decreased to "));
    			Serial.println(currentVolume - 1);
    		  }
    		  volumeDownButtonPressed = true;
    		}
    	  } else if (digitalRead(VOLUME_DOWN_BUTTON_PIN) == HIGH) {
    		volumeDownButtonPressed = false;
    	  }
    	
    	
    	  delay(1000); // Wait for 1 second before reading again
    	}
    	
    Your Image Description
    Your Image Description

    System Integration

    Your Image Description
    Your Image Description

    Done

    Your Image Description
    Your Image Description

    Reflection on My Final Project

    As I complete my final project, I reflect on the significant progress and lessons learned throughout this journey. My project has evolved considerably, providing valuable insights for future improvements.

    Simplified Approach

    I chose to simplify my final project by omitting buttons and the LCD screen, focusing on essential components—the NTC thermistor sensor and the DF player. This approach keeps the project functional and efficient, with plans to enhance it in the future. Additionally, I have decided to add adjustable volume buttons to improve the user experience.

    Enclosure Redesign

    I concluded that redesigning the enclosure to be more appealing and WOW-worthy is essential. Enhancing the design will improve user experience and make the product more enjoyable to use and aesthatically pleasing.

    Electronics and Programming Enhancements

    I decided to add a volume controller, using a button, and switch to the XIAOESP32C3 board for better performance. These enhancements will significantly improve the usability and functionality of my project even for furture enhancements.

    Updates on Enclosure

    The new enclosure design includes a structure for the NTC thermistor and the prayer wheel pivot. This structure acts as a lid and with a hollow block to hold the NTC thermistor module.

    NTC Holder

    The NTC holder is a press-fit design, allowing for adjustable placement of the NTC thermistor module to ensure accurate temperature sensing. It will be 3D printed and tested for fire resistance with a real butterlamp.

    Hinge

    The hinge, designed during week 3, is simple, easy to screw in place, and efficient. I will be 3D printing this componant as well.

    Base

    The base is hollow to house the circuit board, DF player, and speaker with its resonance chamber. I have 3D printed this base.

    Glass Structure Case

    For the glass structure, I created slots to fit the glass pieces and a press-fit feature to attach them to the base. The components will be laser cut and assembled together.

    Electronics and Programming

    In the electronics and programming section, I tested the DF player, speaker, and NTC thermistor module with an Arduino UNO before integrating them into my final project board. The NTC thermistor module senses the butter lamp's temperature and triggers the DF player when the threshold is exceeded, playing prayers. And then tested with the xiao placed on a breadboard, where I faced trouble with the code compatibility with the XIAOESP32C3. After making the required adjustments, it worked out perfect for the final milled board.

    Gratitude

    I extend my heartfelt thanks to my friends, my instructors, Sir Anith, and Sir Rico, for their unwavering support and guidance throughout this journey. And chatgpt for generating me codes and explaning the codes and helping me with the ffmpeg compressions.

    Conclusion

    In conclusion, my final project has been a rewarding and educational experience. I have made significant progress and gained a deeper understanding of design, electronics, and programming. Moving forward, I aim to continue improving and refining my project, making it smarter, more user-friendly, and aesthetically pleasing. This journey has laid a strong foundation for my future endeavors, and I am excited to see where it leads.

    Design files

    Boards

    Enclosure Design files