Naya Lee
Published

How to make a Mood Monitor

How to make a Mood Monitor

BeginnerFull instructions provided1.5 hours108
How to make a Mood Monitor

Things used in this project

Hardware components

SenseCAP K1100 - The Sensor Prototype Kit with LoRa® and AI
Seeed Studio SenseCAP K1100 - The Sensor Prototype Kit with LoRa® and AI
×1
Grove - GSR sensor
Seeed Studio Grove - GSR sensor
×1
Seeed Studio Grove - Universal 4 Pin Buckled 5cm Cable (5 PCs Pack)
Seeed Studio Grove - Universal 4 Pin Buckled 5cm Cable (5 PCs Pack)
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Multitool, Screwdriver
Multitool, Screwdriver

Story

Read more

Code

Mood Monitor

C/C++
#include "TFT_eSPI.h"
#include "Seeed_FS.h" //Including SD card library
#include "RawImage.h"  //Including image processing library

TFT_eSPI tft;
const int GSR=A0;
int sensorValue=0;
int gsr_average=0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

  if (!SD.begin(SDCARD_SS_PIN, SDCARD_SPI)) {
    Serial.println("init failed");
  }
  //Initialise LCD screen
  tft.begin();
  tft.fillScreen(TFT_BLACK);
  tft.setRotation(3);
}

void loop() {
  // put your main code here, to run repeatedly:
  long sum=0;
  for(int i=0;i<10;i++)           //Average the 10 measurements to remove the glitch
      {
      sensorValue=analogRead(GSR);
      sum += sensorValue;
      delay(5);
      }
   gsr_average = sum/10;

   delay(500);
   if (gsr_average<100)
   {
      drawImage<uint8_t>("happy.bmp", 0, 0);
   }
   else
   {
      //tft.fillScreen(TFT_BLACK);
      drawImage<uint8_t>("angry.bmp", 0, 0);
   }
   Serial.println(gsr_average);
}

Credits

Deng Wenyan

Posted by Naya Lee

Comments