Lisa Casaus
Created October 28, 2024

IoT Classroom Communicator - Practical Particle Photon YOU

This comprehension checking tool allows teachers a way to visually gauge students understanding of new material by use of color light input.

8
IoT Classroom Communicator - Practical Particle Photon YOU

Things used in this project

Hardware components

Grove - OLED Display 0.66" (SSD1306)- IIC - 3.3V/5V
Seeed Studio Grove - OLED Display 0.66" (SSD1306)- IIC - 3.3V/5V
×1
LED Stick, NeoPixel Stick
LED Stick, NeoPixel Stick
×5
LED (generic)
LED (generic)
×2
Gravity: I2C BME280 Environmental Sensor
DFRobot Gravity: I2C BME280 Environmental Sensor
×1
Photon
Particle Photon
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Plier, Long Nose
Plier, Long Nose
Hot glue gun (generic)
Hot glue gun (generic)
Breadboard, 830 Tie Points
Breadboard, 830 Tie Points
Laser cutter (generic)
Laser cutter (generic)

Story

Read more

Custom parts and enclosures

Button Cover

Designed to look like the mode and reset buttons on the particle photon 2.

Sketchfab still processing.

Button Cover

button cover

Schematics

Panel Cover Design

Laser cut to look like the particle photon two, this panel houses 5 neopixel strips.

fritzing

Did two boards to see if i could fit everything on the small board.

Code

Midterm-Practical Particle Photon YOU

C/C++
Purpose: neo pixels, connect to WeMo and hue devices, print to OLED screen, use buttons to count and select. The code compiles, but does not yet accomplish all tasks,
/* 
 * Project Midterm-Practical Particle Photon YOU_parts joined
 * Author: Lisa Casaus
 * Date: November 1-4, 2024
 * For comprehensive documentation and examples, please visit:
 * https://docs.particle.io/firmware/best-practices/firmware-template/
 */

// Include Particle Device OS APIs
#include "Particle.h"
#include "neopixel.h"
#include "Colors.h"
#include "IoTclassroom_CNM.h"
#include "Button.h"
#include "math.h"
#include "Adafruit_BME280.h"
#include "Adafruit_SSD1306.h"


//LED HEAD
const int LEDPIN_BLUE = D7;
const int LEDPIN_YEL = D6;

//NEOPIXEL
const int PIXELCOUNT = 41; 
const int OFFSET = 16;
int start;
int end;
int bri=16;
int color;
int segment;
//BUTTON
Button tableRow (D13);
Button colorColumn (D14);
int rowCount;
int columnCount;
bool forLoopTrigger;
//BME HEAD TEMP
Adafruit_BME280 bme; //Adafruit_BME280 Read (bme);when i do not include the 'read' it does not turn green...why?
int hexAddress  = 0x76; //0x76 hex
const char degree = 0xF8;
float tempC;
int celcius;
float fahrenheit;
float celciusToFahrenheit (int celcius);
bool Status;
int currentTime;
int lastSecond;
int printValues;
//OLED HEAD
const int OLED_RESET =-1;
Adafruit_SSD1306 display (OLED_RESET);
//WEMO and HUE HEAD
const int WEMOone = 0;
const int WEMOtwo = 1;
const int WEMOthree= 2;
const int BULBone = 1;
const int BULBtwo = 2;
const int BULBthree = 3;
Button WemoButton (D14);
const int BUTTONPIN = D14;
bool buttonClicked;
bool onOff;
//ARRAY, Thanks for the tabel EJ. It helped.
void pixelFill( int startPixel , int endPixel  , int color );
int tableArray[5][8]{//first square bracket is row, second is column
{0,1,2,3,4,5,6,7},
{8,9,10,11,12,13,14,15},
{16,17,18,19,20,21,22,23},
{24,25,26,27,28,29,30,31},
{32,33,34,35,36,37,38,39}};

Adafruit_NeoPixel pixel(PIXELCOUNT, SPI1 , WS2812B);
SYSTEM_MODE(SEMI_AUTOMATIC);

void setup() {
//serial monitor
Serial.begin (9600);
rowCount=0; // tell it where to start
forLoopTrigger = false;

//NEOPIXELS
pixel.begin();
pixel.setBrightness(bri);
pixel.show();

//LED
pinMode (LEDPIN_BLUE,OUTPUT);
pinMode (LEDPIN_YEL,OUTPUT);

//WEMO
WiFi.on();
WiFi.clearCredentials();
WiFi.setCredentials("IoTNetwork");
  
WiFi.connect();
while(WiFi.connecting()) {
  Serial.printf(".");
  }
  Serial.printf("\n\n");


//BME
Status = bme.begin (0x76);
if (Status == false) {
  Serial.printf ("BME at address 0x%2X failed to start\n",hexAddress);
}
//OLED
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); 
display.clearDisplay();
display.setTextSize (2);
display.setTextColor (WHITE);


}

void loop() {
//NEOPIXELS AUTO -- NOTE, when I tried to implement the code below, had some issues, plus it is not finished. SORRY!
for(segment=0; segment<8; segment++){
  start = 8*segment;
  pixelFill(start,start+7,rainbow[segment]);
}

   
//I did get the button to turn on white lights at one point but there was an overlap that cuased some disturbing blinking
//at the moment, I get an orange flash on the microcontroller when button is clicked. 
if (tableRow.isClicked()){
  color ++;
  //pixelFill(0, 1, white);  //NEoPIXELS
  //pixel.setPixelColor (tableArray[tablenum][status],colorArray[status]);
  pixel.setPixelColor (tableArray[0][6],cyan);
  pixel.setPixelColor (tableArray[1][14],cyan);
  pixel.setPixelColor (tableArray[2][22],cyan);
  pixel.setPixelColor (tableArray[3][30],cyan);
  pixel.setPixelColor (tableArray[4][38],cyan);

  }

if (tableRow.isClicked()) {
  rowCount++;//tell it go up by one
  Serial.printf("Row=%i\n",rowCount);
  }

//BUTTON COUNTER
if (rowCount == 5) {
  rowCount=0; //tell it to reset
  forLoopTrigger= true;//you use a forloop to do something to a group of things at the same time 
  //-- use bool to control the foreloop, otherwise they might conflict, cancel each other out
}

if (colorColumn.isClicked()) {
  columnCount++;//tell it go up by one
  Serial.printf("column=%i\n",columnCount);
}

forLoopTrigger = false;

//statement above defines fLT as true same as  ==true, below is true
if (forLoopTrigger){ // can only get into the for loop if previous statement is true
  for (columnCount = 0; columnCount <40; columnCount++) {
  Serial.printf("column count colors %i\n",columnCount);//Serial.printf("what you want happen, Ex, using a forloop to count %i\n", variable);/replace this serial print with what you want to happen, number of times  
  } 
} 
forLoopTrigger = false;

 //BME
  currentTime = millis();
  tempC = bme.readTemperature(); //celcius
  fahrenheit = tempC * (9.0/5.0)+32;
 
if((currentTime-lastSecond)>2000) { //run twice per second slide 224/assingment 279
  lastSecond=millis();
  Serial.printf("Temperature %0.1f =%0.1f\n",fahrenheit );
  display.setCursor(0,0);
  display.printf("Temperature %0.1f\n",fahrenheit );
  display.display();
}

if (tempC < 75 ) {
  Serial.printf ("It is too cold in here! %i\n", WEMOthree);
  wemoWrite(WEMOthree, HIGH);
  }
else {
  wemoWrite (WEMOthree,LOW);
}
 
  }


void pixelFill( int startPixel , int endPixel  , int color ){
  
for(int i=startPixel; i<=endPixel; i++){
  pixel.setPixelColor (i,color);
    }

pixel.show();
 

 }

Credits

Lisa Casaus
2 projects • 5 followers

Comments