Once we had completed what we could during our workshop day (see post about working with Neil Fyffe), I completed the woodworking portion of this project at the Napier workshop where I sanded the shade to smooth the shape and remove the top coat finish. I then taped up the openings for the electronic sensors and gave the lamp multiple coats of wood wax to enhance its natural aesthetic.
Finishing by sanding and applying multiple layers of wood wax.
I also obtained a new Seeduino board (thanks to Richard at Proto-pic) and proceeded in my next attempt to load the code and complete the electronics within the lamp. (see my previous attempts here)
Finally success!
I shared the results of this project with the online Arduino Reddit Community here.
Final Video
Project Photos
Final Code
The following is the final code loaded to the board.
const int ledPin = LED_BUILTIN; // the number of the LED pin
// Variables will change:
int ledState = LOW; // ledState used to set the LED
int relay1State = LOW;
int relay2State = LOW;
// Generally, you should use "unsigned long" for variables that hold time
// The value will quickly become too large for an int to store
unsigned long previousMillis = 0; // will store last time LED was updated
unsigned long previousSensorRead1 = 0;
unsigned long previousSensorRead2 = 0;
unsigned long time;
// constants won't change:
const long sensorInt1 = 3000;
// board assignments:
const int relay1 = 2;
const int relay2 = 3;
const int Sensor1 = A0;
const int Sensor2 = A2;
// the setup function runs once when you press reset or power the board
void setup() {
// set the digital pin as output:
pinMode(ledPin, OUTPUT);
// set others:
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
Serial.begin(9600);
}
// the loop function runs over and over again forever
void loop() {
delay (1500);
// here is where you'd put code that needs to be running all the time.
int sensorValue1 = analogRead(Sensor1);
int sensorValue2 = analogRead(Sensor2);
unsigned long currentMillis = millis();
//TIME
Serial.print("MillisSinceStart: ");
//prints time since program started
Serial.println(currentMillis);
// wait so as not to send massive amounts of data
delay(1);
//SENSOR READING PRINTING
Serial.print("1.");
Serial.println(sensorValue1);
delay(1);
Serial.print("2.");
Serial.println(sensorValue2);
delay(1);
// RELAY1
if (sensorValue1 > 1.5) {
if (currentMillis - previousSensorRead1 >= sensorInt1) {
previousSensorRead1 = currentMillis;
if (relay1State == LOW) {
relay1State = HIGH;
}
else {
relay1State = LOW;
}
digitalWrite(relay1, relay1State);
}}
// RELAY2
if (sensorValue2 > 2.5) {
if (relay2State == LOW) {
}
relay2State = HIGH;
}
else {
relay2State = LOW;
}
digitalWrite(relay2, relay2State);
//Loop End
}
Sharing to Reddit
The following is the shared project post on Reddit.
This post relates to a project page, view the project page to see other related posts and outcomes.
Click Here to return to Journal Posts on Project Page
or click Next Post below to keep reading posts in this category