Connecting color detector sensor, data logger, and RTC to Arduino Uno

Hello,

I am trying to learn how to work with electronics. My desired project is to use a color detector sensor (Atlas Scientific) to read colors and record readings utilizing a data logger and RTC. Based on the color detected, the corresponding color on an RGB LED will illuminate a fiber optic fabric. However, I need the RGB LED to fade in and out like the screensaver on a computer monitor.

I have no experience in electronics, hardware assembly, or programming. I have purchased the following items to get started with my project:

Arduino Uno R3
USB Cable
LED RGB clear common cathode
Resistor 330 Ohm
Fiber optic fabric
Open Log
Jumper wires
Breadboard ( small, about same size as the Arduino)
8 pin female headers
Alligator test leads
Color detector sensor

I have spent many hours looking for videos and forums. If someone can give me an idea where to begin or recommend a book, I would greatly appreciate it. My deadline is Oct. 20.

Thank you!

I have 30 yrs experience with electronics. I am not a programmer per se but I get by .
You need to give us a bit more of a SITREP (Situation Report).
Besides your googling , have you done anything else ? (any hands on experience with arduino or anything ?)
Have you even run the Blink Example successfully yet ?
Why are you doing this ? (what's with the Oct-20 deadline ?)
You apparently are not familiar with forum protocol.
Your initial briefing (post) should include what you have posted already , along with any needed datasheets , such as for sensors.
You owe us a link or datasheet for your sensor.
You owe us a link or datasheet for your optic fiber

record readings utilizing a data logger and RTC

Define "datalogger"
The RTC is not listed in your parts list . What's up with that ?

My desired project is to use a color detector sensor (Atlas Scientific) to read colors and record readings utilizing a data logger and RTC. Based on the color detected, the corresponding color on an RGB LED will illuminate a fiber optic fabric. However, I need the RGB LED to fade in and out like the screensaver on a computer monitor.

You have some homework to do. By now you should already have the arduino working and the rgb led fading in and out using nothing more than google. If you don't believe, try it.
Your assignment is as follows:
1- breadboard rgb led and get it fading up and down using nothing more than google with the word "arduino" at the beginning of all your searches.
2- Obtain the RTC, and get it working using the examples in the library. (using nothing more than google with the word "arduino" at the beginning of all your searches.)
3- Obtain an SD shield or module for the datalogger unless you plan to use the serial monitor.
4- Draw a schematic of your circuit,( using nothing more than google with the word "arduino" at the beginning of all your searches.)
tic toc....

Thank you very much for your reply.

In response to your questions:

My September 26, 2014 post was my first. I have no prior experience working with electronics or with Arduino.

So far, I have downloaded the Arduino software and installed the Arduino Uno drivers. I have run the blink example sample successfully on a mini HP using Windows 7.

I am doing this project for science fair as a continuation of the project I did last year on camouflage fabric. This year, I would like to improve my prototype by making the camouflage active, using the color detector sensor and the fading RGB LEDs. The Oct. 20 deadline is set by my teacher, where the research paper and project board must be completed by that date. Unfortunately, I just found out my project was approved yesterday. Today is my official start date. This project is for a regional science and engineering fair.

I thought I would need an RTC if I wanted to test colors outside versus on a computer monitor. I thought it would be important to have the time stamp associated with the data, assuming that colors and RGB values change with the light intensity in the course of a day.

Sorry about the "data logger" term. I have an Open Log. Again, since I need to tabulate and collect data for my experiment, I thought I would need this component. I am hoping to extract some of the information from the Open Log as my data.

The link for the color detector sensor data sheet is:

http://www.atlas-scientific.com/_files/_datasheets/_probe/ENV-RGB.pdf

There is no datasheet for the fiber optic fabric. It is manufactured by Sensingtex. Basically, the fiber optics are woven into the fabric where they are terminated in a bundle at one end and secured by a metal collar. An LED can illuminate the fabric by inserting the led in the metal collar and sealing it with a tube of heat shrink.

I will do the homework you assigned and post again when I have completed it. I would have done the fading led tonight, but I have 330 Ohm resistors, not 220 Ohm resistors that are listed on the arduino website. Since I know nothing about electronics, I didn't know if using a higher resistance would do any damage to the Uno.

For #3 of the homework you mentioned getting a SD Shield. Can I collect the data from the Open Log and save it onto my computer? Does the computer act as a serial monitor?

I am not asking for anyone to do my project for me. I know what I want to accomplish, but I'm not sure where to start or how to get there. Ideally, it would have been helpful to have a mentor guide me through the process. Normally, I would have more time to work on this project. However, our teacher has given us a very tight timeline. Therefore, I truly appreciate your guidance and expertise in helping me acquire some electronic skills and knowledge while achieving my goal.

Thank you for your time! :slight_smile:

I will do the homework you assigned and post again when I have completed it. I would have done the fading led tonight, but I have 330 Ohm resistors, not 220 Ohm resistors that are listed on the arduino website. Since I know nothing about electronics, I didn’t know if using a higher resistance would do any damage to the Uno.

I can see we have our work cut out for us. You are really starting from square one.
Ok, let’s get some basics out of the way.
You basically only need two equations to calculate most of what you need to know with regard to electronics.
Ohms Law
V (Volts = I (Amps) * R (ohms)
P(Watts)= I (Amps) * V (Volts)

These equations are only useful if you do your homework and use datasheets or look up the specs for devices you are using.
In this case , we are talking about an RGB Led.

There’s a special Hell for people who don’t read datasheets. It’s a place where nothing works and everything smokes when you turn on the power. Word to the wise.
The forward voltage for the RGB leds is 2 V for the red, and 3.2 V for the Green & Blue.
Leds are diodes, which means that the voltage drop across them is predicable within the tolerences. A silicon recifier diode is going to drop 0.7 Volts across it, a Germanium about 0.3V and a typical red led about 2 V. If your power supply is 5V, and the led drops
2V , then how much voltage do you need to drop across the current limiting resistor ? (5-2=3V) It’s not rocket science.
If you need to drop 3V across the resistor and the datasheet says the led draws 20 mA (0.020A), then what value resistor would drop 3 V with 20 mA current ? (3V / 0.020 A =150 ohms) So if you only have 330 ohm resistors and you need 150 ohms what do you do ? Again, the basics, (all of this you can learn using Google, so this is a freebee. Don’t expect me to do this for all of your stuff. I expect you to do some footwork.
Basics, resistors in parallel :
Two resistors : RT =(R1 x R2)/(R1+R2)
Let R = 330 ohms=R1 =R2,
(330x330)/(330+330)= 108900/660 =165 OHMS (But WAIT ! Isn’t that HALF of 330 ? Yes it is . Everyone else knows the total resistance of two equal value resistors is half the value of one. I did that calculation so you know how to calculate the total when they are not equal.
So you can put two 330 ohm resistors in parallel (you DO know what THAT means don’t you ?) in series with the leds.
The green and blue have a Vf of 3.2V (5-3.2=1.8V) 1.8 V/0.020 A = 90 ohms .
How do you calculate the total resistance of MORE than TWO resistors in parallel ?

1 1 1 1 1 1
— = — + — + — + — … + —
RT R1 R2 R3 R4 Rn

Let R = 330 ohms =R1 = R2 = R3

1/RT =1/330 + 1/330 +1/330 = 0.00909
RT =110 (YES, thats 330/3. Coincidence ? )
The green and blue have a Vf of 3.2V (5-3.2=1.8V) 1.8 V/0.020 A = 90 ohms = ~ 110 ohms (three 330 resistors in parallel)

FADING RGB LEDS
https://www.google.com/#q=arduino+rgb+fade+sketch

HOMEWORK
1-Practice fading RGB leds
2-Read color sensor datasheet and post a photo of a schematic of how you think you should connect it to the arduino
(DO NOT POWER IT UP YET)

http://atlas-scientific.com/_files/code/Arduino-sample-code-EZ-COM.pdf
http://atlas-scientific.com/_files/instructions/Wiringdiagram_ENV_RGB.pdf

Sorry about the “data logger” term. I have an Open Log.

When you post a comment like this , please remember to post a link to explain what you are talking about. You can’t assume everyone knows what an "OpenLog " is and there may be more than one . I am assuming you mean the Sparkfun product.

I don’t have one so you are probably going to have do most of that R&D by yourself but I can help you interpret the information on the Sparkfun site. (it looks pretty much plug & play)
Remember, Google is your friend…

How do you calculate the total resistance of MORE than TWO resistors in parallel ?

1 1 1 1 1 1
--- = --- + --- + --- + --- ....... + ---
RT R1 R2 R3 R4 Rn

Incidentally - doing the calculation in this manner is much, much easier than using the product over sum technique if you have a calculator that does RPN (reverse polish notation) like the original HP models.

Here's the sequence:
For two resistors:
R1, 1/x, R2, 1/x, +, 1/x

For more than two resistors:
R1, 1/x, R2, 1/x, +, R3, 1/x, +, R4, 1/x, +, . . . Rn, 1/x, +, 1/x

Don

You mean like Windows Calculator in Scientific Mode ?

I’m running the following RGB FADE sketch using 120 ohm resistors:

  const int redPin = 11;
const int greenPin = 10;
const int bluePin = 9;
 
void setup() {
  // Start off with the LED off.
  setColourRgb(0,0,0);
}
 
void loop() {
  unsigned int rgbColour[3];
 
  // Start off with red.
  rgbColour[0] = 255;
  rgbColour[1] = 0;
  rgbColour[2] = 0;  
 
  // Choose the colours to increment and decrement.
  for (int decColour = 0; decColour < 3; decColour += 1) {
    int incColour = decColour == 2 ? 0 : decColour + 1;
 
    // cross-fade the two colours.
    for(int i = 0; i < 255; i += 1) {
      rgbColour[decColour] -= 1;
      rgbColour[incColour] += 1;
      
      setColourRgb(rgbColour[0], rgbColour[1], rgbColour[2]);
      delay(5);
    }
  }
}
 
void setColourRgb(unsigned int red, unsigned int green, unsigned int blue) {
  analogWrite(redPin, red);
  analogWrite(greenPin, green);
  analogWrite(bluePin, blue);
 }

RE: Reading Color Sensor
You are going to need to parse the CSV text received from the sensor. Do you plan to do that AFTER storing it on the SD card or at the same time ? (if that is even possible)

Use a Terminal Capture program like ClearTerm and capture the color sensor output and post the text file so we can see what the data looks like. You’ll need that as a sample to write the CSV-parse code.

You mean like Windows Calculator in Scientific Mode ?

I don't think that's capable of RPN. An RPN calculator does not have or need parentheses or an '=' key and it does have an 'Enter' key.

Typically most calculations take fewer keystrokes using RPN, frequently a lot fewer. Compare the product over sum technique for 2 resistors and you will see what I mean.

(, R1, *, R2, ), /, (, R1, +, R2, ), = --> 12 keystrokes (It's been a long time, I think that's right)

R1, ENTER, R2, *, R1, ENTER, R2, +, / --> 9 keystrokes

for comparison: R1, 1/x, R2, 1/x, +, 1/x --> 6 keystrokes

Here's what I use --> http://hp-15c.homepage.t-online.de/ . I also have a real one.

Don

Ok, I guess it is a little easier on an HP-48 , but while the Windows calculator doesn't have a STACK, it does have the reciprocal key and a MS & MR key so you can sort of simulate a quasi=STACK enough to get by if you don't have an RPN calculator. I have an HP-48
only 10 feet away but it isn't that much trouble using Windows calculator, but I do know what you mean.