Eric Lowe
Published

Aquaneers

Automated colour transmission and reflection measurement system for quantifying results of measurements with a colour change.

IntermediateWork in progress2,251
Aquaneers

Things used in this project

Hardware components

RGB Diffused Common Anode
RGB Diffused Common Anode
×1
Photo resistor
Photo resistor
×3
Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1

Software apps and online services

Arduino IDE
Arduino IDE
openScad

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Sensor and tube holder - Paremetric

openScad file for making sensor and tube holder. Has holes for one RGB LED and up to 4 LDRs for transmission and reflection measurements.

Parametric file can be edited for other tube sizes.

Sensor and tube holder - 5ml tube

STL file ready to 3D print.
Recommended 25% infill 0.2-0.4mm nozzle

Schematics

Colour sensor Schematic

Circuit layout, and arduino pins used for the automated colour sensor

Code

Colour sensor test code

Arduino
This code cycles through red, green, blue, and 'white' transmission and reflection measurements and transmits readings back to a serial console.
#define redLED 3
#define greenLED 6
#define blueLED 5

/* Note the colours of the sensors below correspond to the wire colours used in my build*/
#define yellowSensor 0 
#define purpleSensor 1
#define pinkSensor 2

#define delayTime 100

struct SensorReading{
  int pink;
  int yellow;
  int purple;
};


void setup() {
  // put your setup code here, to run once:
  pinMode(redLED, OUTPUT);
  pinMode(greenLED, OUTPUT);
  pinMode(blueLED, OUTPUT);

  digitalWrite(redLED, HIGH);
  digitalWrite(greenLED, HIGH);
  digitalWrite(blueLED, HIGH);

  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  SensorReading s;
  char buffer[200];
  
  redOn();
  delay(delayTime);
  readSensors(s);

  sprintf(buffer, "Red %d %d %d",s.pink, s.purple, s.yellow);
  Serial.println(buffer);
  
  greenOn();
  delay(delayTime);
  readSensors(s);
  
  sprintf(buffer, "Green %d %d %d",s.pink, s.purple, s.yellow);
  Serial.println(buffer);
  
  blueOn();
  delay(delayTime);
  readSensors(s);

  sprintf(buffer, "Blue %d %d %d",s.pink, s.purple, s.yellow);
  Serial.println(buffer);
  
  whiteOn();
  delay(delayTime);
  readSensors(s);

  sprintf(buffer, "White %d %d %d",s.pink, s.purple, s.yellow);
  Serial.println(buffer);

  delay(5000);
}


void redOn(){
  digitalWrite(redLED, LOW);
  digitalWrite(greenLED, HIGH);
  digitalWrite(blueLED, HIGH);}

void greenOn(){
  digitalWrite(redLED, HIGH);
  digitalWrite(greenLED, LOW);
  digitalWrite(blueLED, HIGH);}

void blueOn(){
  digitalWrite(redLED, HIGH);
  digitalWrite(greenLED, HIGH);
  digitalWrite(blueLED, LOW);}

void whiteOn(){
  digitalWrite(redLED, LOW);
  digitalWrite(greenLED, LOW);
  digitalWrite(blueLED, LOW);}

void readSensors(SensorReading& s ){
  s.pink = analogRead(pinkSensor);
  s.purple = analogRead(purpleSensor);
  s.yellow= analogRead(yellowSensor);
}

Credits

Eric Lowe

Eric Lowe

1 project • 2 followers

Comments