Posts with «photoresistor» label

Co41D 2020 MIDI Theremin Sounds Pretty Sick

As the pandemic rages on, so does the desire to spend the idle hours tinkering. [knaylor1] spent the second UK lockdown making a sweet Theremin-inspired noise machine with a low parts count that looks like a ton of fun.

It works like this: either shine some light on the photocells, cover them up, or find some middle ground between the two. No matter what you do, you’re going to get cool sounds out of this thing.

The photocells behave like potentiometers that are set up in a voltage divider. An Arduino UNO takes readings in from the photocells, does some MIDI math, and sends the serial data to a program called Hairless MIDI, which in turn sends it to Ableton live.

[knaylor1] is using a plugin called TAL Noisemaker on top of that to produce the dulcet acid house tones that you can hear in the video after the break.

If you’ve never played with light-dependent resistors before, do yourself a favor and spend a little bit of that Christmas cash on a variety pack of these things. You don’t even need an Arduino to make noise, you can use them as the pots in an Atari Punk console or make farty square waves with a hex inverting oscillator chip like the CD40106. Our own [Elliot Williams] once devoted an entire column to making chiptunes.

Solar Panel System Monitoring Device Using Arduino

[Carl] recently upgraded his home with a solar panel system. This system compliments the electricity he gets from the grid by filling up a battery bank using free (as in beer) energy from the sun. The system came with a basic meter which really only shows the total amount of electricity the panels produce. [Carl] wanted to get more data out of his system. He managed to build his own monitor using an Arduino.

The trick of this build has to do with how the system works. The panel includes an LED light that blinks 1000 times for each kWh of electricity. [Carl] realized that if he could monitor the rate at which the LED is flashing, he could determine approximately how much energy is being generated at any given moment. We’ve seen similar projects in the past.

Like most people new to a technology, [Carl] built his project up by cobbling together other examples he found online. He started off by using a sketch that was originally designed to calculate the speed of a vehicle by measuring the time it took for the vehicle to pass between two points. [Carl] took this code and modified it to use a single photo resistor to detect the LED. He also built a sort of VU meter using several LEDs. The meter would increase and decrease proportionally to the reading on the electrical meter.

[Carl] continued improving on his system over time. He added an LCD panel so he could not only see the exact current measurement, but also the top measurement from the day. He put all of the electronics in a plastic tub and used a ribbon cable to move the LCD panel to a more convenient location. He also had his friend [Andy] clean up the Arduino code to make it easier for others to use as desired.


Filed under: Arduino Hacks

Lightefface Makes Music with Both Touch and Light

Kacper Ziemianin made a simple piano keyboard with an Arduino and some photoresistors. But it's what he does with the data that makes beautiful music.

Read the full article on MAKE

MAKE » Arduino 18 Feb 20:30

Tracking Solar Brightness with a Homemade Sun Logger

The Sun Logger, a data logging device, combines several components we’ve used in previous Weekend Projects. You may recognize the light-sensitive photoresistor (Optical Tremolo Box) and the Arduino Uno microcontroller (Touchless 3D Tracking Interface). These parts, when combined with a 74AHC125 Level Shifter and SD card socket mounted on a homemade “shield,” will record the levels of light shining down on your project box. That data, recorded every 15 seconds to the SD card, can be exported later to any popular spreadsheet software and graphed, giving you a visual representation of light changes over time. This data could aid in knowing where best to plant a garden, or simply to understand changes of light intensity throughout the seasons in your micro-climate.

And while this project is readymade for recording levels of sunlight, the Arduino has a total of six analog inputs (labeled A0 – A5) and could easily record other variables. For example temperature, motion, or barometric pressure. Makers looking for a mid-level Arduino build, or knowledgeable coders looking to solder together their first homemade shield, the Sun Logger is a great project to build!


Filed under: Arduino, MAKE Projects, Weekend Projects

Led as light sensor [Arduino]

If you connect led in the opposit way he can act as light sensor:

positive leg to analog pin

negative leg to 5V

You can use that for some things, but he not sensetive as LDR,

ןf you use a for example a green led he not "see" well red light

If you use charlieplexing method you can control one led to light and as a light sensor.

The idea is like this:

Two wires connect the led to two analog pins.

To light the led you set the two analog pins as digital output and one high one low. 

read more

Jumper: Arduino controlled animation

In this project, I have connected an Arduino to my computer and used a photoresistor to control an animation on the screen. Other sensors could have been used, but I chose a photoresistor because it feels like magic!!

The photoresistor responds to changes in ambient light as my hand moves up and down. The Arduino sends the reading to a Processing sketch on the computer via a Serial command (through the USB cable). The processing sketch interprets the signal from the Arduino and selects the appropriate picture to display.

I took a series of screenshots from the following YouTube video: http://www.youtube.com/watch?v=h6nE8m74kDg  And after borrowing a bit of code from these sites (1,2), the project was born.
This idea is not new, nor my own. There are many people who have done this project before, but I thought to blog about how I have done it, just for fun.

The Project Movie




Components Required


  • Arduino Uno (and associated software), and USB cable
  • Photoresistor or Photocell
  • 10K resistor
  • Wires to put it all together
  • Processing IDE from http://processing.org
  • Computer/laptop


The Arduino Sketch






The Arduino Code:

You can download the Arduino IDE from this site.
 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
40
41
42
43
44
45
46
47
48
49
/* Jumper: Using an Arduino to animate:
Written by ScottC on 02/06/2012 */

int photoRPin = 0;
int minLight;
int maxLight;
int lightLevel;
int adjustedLightLevel;
int oldLightLevel;

void setup() {
Serial.begin(9600);

//Setup the starting light level limits
lightLevel=analogRead(photoRPin);
minLight=lightLevel-10;
maxLight=lightLevel;
oldLightLevel=lightLevel;
}

void loop(){
lightLevel=analogRead(photoRPin);
delay(10);

//auto-adjust the minimum and maximum limits in real time
if(minLight>lightLevel){
minLight=lightLevel;
}
if(maxLight<lightLevel){
maxLight=lightLevel;
}

//Map the light level to produce a result between 1 and 28.
adjustedLightLevel = map(lightLevel, (minLight+20), (maxLight-20), 1, 28);
adjustedLightLevel = constrain (adjustedLightLevel, 1,28);

/*Only send a new value to the Serial Port if the
adjustedLightLevel value changes.*/
if(oldLightLevel==adjustedLightLevel){
//do nothing if the old value and the new value are the same.
}else{
//Update the oldLightLevel value for the next round
oldLightLevel=adjustedLightLevel;

/*Send the adjusted Light level result
to Serial port (processing)*/
Serial.println(adjustedLightLevel);
}
}

The code above was formatted using this site.



The Processing Code:

You can download the Processing IDE from this site.

 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* Jumper: Using an Arduino to animate
Written by ScottC on 02/06/2012

Source code derived from :
http://processing.org/learning/topics/sequential.html
http://processing.org/discourse/beta/num_1267080062.html

Pictures captured from:
http://www.youtube.com/watch?v=h6nE8m74kDg

======================================================= */

import processing.serial.*;
Serial myPort;
String sensorReading="";

// Create the array that will hold the images
PImage[] movieImage = new PImage[29];

/* The frame variable is used to control which
image is displayed */
int frame = 1;



/* Setup the size of the window. Initialise serial communication with Arduino
and pre-load the images to be displayed later on. This is done only once.
I am using COM6 on my computer, you may need replace this value with your
active COM port being used by the Arduino.*/

void setup(){
size(700,600);

myPort = new Serial(this, "COM6", 9600);
myPort.bufferUntil('\n');

for(int i=0;i<28;i++){
movieImage[i] = loadImage("Jumper" + (i+1) + ".jpg");
}
}




// The draw function controls the animation sequence.

void draw(){

//this draws the relevant image to the window
image(movieImage[frame-1],0,0,width,height);
}

void serialEvent (Serial myPort){
sensorReading = myPort.readStringUntil('\n');
if(sensorReading != null){
sensorReading=trim(sensorReading);
if (sensorReading.length()<2){
frame = integerFromChar(sensorReading.charAt(0));
}else{
frame = integerFromChar(sensorReading.charAt(0))*10;
frame += integerFromChar(sensorReading.charAt(1));
}
}
}



/* This function used to convert the character received from the
serial port (Arduino), and converts it to a number */

int integerFromChar(char myChar) {
if (myChar < '0' || myChar > '9') {
return -1;
}else{
return myChar - '0';
}
}

The code above was formatted using this site.


The pictures 

Captured from this YouTube Video: http://www.youtube.com/watch?v=h6nE8m74kDg