Skill Dev IV

Made by Tiffany Han

A sensor presenting lighting data

Created: November 24th, 2023



    • I tried to make a product where the data of "how much light" there is in the room is presented in an interesting and interactive way. 
    • I thought I may combine some of things I learned in this class by incorporating a photoresistor sensor as well as use a servo motor. 
    • Inspired by an example shown in class, I used a stick and some paper cutup to represent data by attaching the stick to the servo motor. 

int servoPin = A3;
Servo myServo;
int servoPos = 0;

int photoCellPin = A5;
int photoCellReading = 0;

void setup() {
      // attaches the servo on the A3 pin to the servo object
  myServo.attach( servoPin );
  Particle.function("servo", servoControl);
  Particle.variable(  "servoPos" , &servoPos , INT );


void loop() {
    photoCellReading = analogRead(photoCellPin);
    servoPos = map(photoCellReading, 3000, 4095, 0, 180);
    myServo.write( servoPos);


int servoControl(String command)
    // Convert
   int newPos = command.toInt();
   if (newPos = (-1)) {
        servoPos = map(photoCellReading, 3000, 4095, 0, 180);
        myServo.write( servoPos);
        // Make sure it is in the right range
        // And set the position
        servoPos = constrain( newPos, 0 , 180);
        // Set the servo
        myServo.write( servoPos );
   // done
   return 1;
Click to Expand


I ran into some issues with integrating the photoresistory, however upon reviewing the circuit diagrams I was able to revise my mistakes. Updating the range on the mapping function allows the motor to be integrated with the appropriate angle. I feel that through this project I was able to gain a deeper understanding of the both circuits and the components I used.

Share this Project


48-675 Designing for the Internet of Things

· 11 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.


A sensor presenting lighting data