I have given up on using a PS3 controller with the Arduino boards, I think that someone will be able to do it, but I don't have the time as I am studying for my A-levels.
I did however come across this video which showed Bluetooth connectivity between a 3D printer and a computer instead of using a cable.
Video - http://www.youtube.com/watch?v=6yx5kp7M7CE
I might try this at some later date.
This is my Blog where I will share what I am up to, whether it be coding, designing or building my own programs, ideas or project
Search This Blog
Translate
Showing posts with label Projects. Show all posts
Showing posts with label Projects. Show all posts
Thursday, 18 September 2014
Thursday, 11 September 2014
I2C UNO and MEGA for RepRap Prusa i2 control using PS3 controller.
For the last couple of weeks I have been trying to connect a PS3 controller to my i2 however it hasn't been going as well as I though it would.
I thought that using an UNO with the USB Host Shield would be able to communicate with the Mega through I2C and then send G-code to the printer when buttons are pressed on the controller.
However I am unable to get I2C communication at all, I have tried a few tutorials to no avail, I can get basic sketches to work with the Uno and Mega without Ramps 1.4 attached, but when I but the Ramps board on and use the I2C pins on that, nothing happens.
I have tried setting the Uno slave and Mega Master and vise versa but this still doesn't help.
If anyone has any ideas please leave a comment.
Thursday, 4 September 2014
PS3 controlling RepRap Prusa i2 using UNO and I2C
I am still trying to connect my i2 to a PS3 controller and this time, instead of using the mega to attach the USB host Shield to, I will try to use and Arduino Uno instead and send which buttons are pressed to the mega through the I2C.
This way I avoid having to use the Mega's inaccessible ICSP pins.
If this doesn't work i may try doing it through Bluetooth.
This way I avoid having to use the Mega's inaccessible ICSP pins.
If this doesn't work i may try doing it through Bluetooth.
Thursday, 28 August 2014
PS3 controller with 3D RepRap Prusa i2
I am currently trying to control my i2 using a PS3 controller. I have bought one of these and I plan on trying to connect it to the Mega with the un-used pins and then when a button is pressed G-code of your choice is written to the serial line for your printer to execute.
To test the USB host shield I followed this tutorial - http://www.youtube.com/watch?v=q3vXTX6Qe54
This shows you that when a button is pressed it prints that button to the serial monitor. I just used a Uno with nothing else attached.
The board also worked great with a Mega, however I could get it to work when the Ramps 1.4 shield was also attached. This was because I couldn't get access to the 6 ICSP header pins in the middle of the Mega. I wasn't will to solder wires to these headers and so despite trying to find another way I couldn't.
If anyone could help me I would be very grateful as I think it would be great.
To test the USB host shield I followed this tutorial - http://www.youtube.com/watch?v=q3vXTX6Qe54
This shows you that when a button is pressed it prints that button to the serial monitor. I just used a Uno with nothing else attached.
The board also worked great with a Mega, however I could get it to work when the Ramps 1.4 shield was also attached. This was because I couldn't get access to the 6 ICSP header pins in the middle of the Mega. I wasn't will to solder wires to these headers and so despite trying to find another way I couldn't.
If anyone could help me I would be very grateful as I think it would be great.
Thursday, 19 June 2014
Arduino with a thermistor, LDR and RGB LED which changes colour based on temperature - prints data to PLX-DAQ Excel spreedsheet
Code gets:
- Temperature from a thermistor
- Light value from an LDR
and
RGB LED changes colour depending on the Temperature
Prints the data to the Serial Monitor
Data is sent to an Excel spreadsheet through data
acquisition software, PLX-DAQ, Download here
Please let me know if you experience any problems with this
code. Be sure to check back for more Arduino code.
Schematic:
/*
Oliver Holden
Created 28/10/2014
Components:
* Arduino UNO
* Thermistor
* 10K resistor
* LDR
* 10K resistor
* RGB LED
* 3x 220 ohm resistors
- Gets Temperature form a Thermistor
- Gets an analogue value of Light from an LDR
- RGB LED changes colour depending on the Temperature
Prints the data to the Serial Monitor
Data is sent to an Excel spreadsheet through data
acquisition software, PLX-DAQ, Download http://www.parallax.com/downloads/plx-daq
Schematic for this project is on
http://electrical-teen.blogspot.co.uk/
*/
int redPin = 11; // Red LED, connected to digital pin 11
int grnPin = 10; // Green LED, connected to digital pin 10
int bluPin = 9; // Blue LED, connected to digital pin 9
int ThermistorPin = A0; // Thermistor Reading pin
int LDRPin= A2; // LDR Reading pin
int LDRReading = analogRead(LDRPin); // Reading LDR analogue value
int x = 0; // For PLX-DAQ
int row = 0; // For PLX-DAQ
void setup()
{
Serial.begin(9600); // Opening serial connection at 9600bps
Serial.println("Thermistor temperature and LDR light measurement:"); // Printing Serial Monitor header
Serial.println("LABEL, Time, T (C), LDR"); // Setting headers of colums in PLX-DAQ spreadsheet
Serial.println("\n-----------------------------");
pinMode(redPin, OUTPUT); // sets the LED pins as output
pinMode(grnPin, OUTPUT);
pinMode(bluPin, OUTPUT);
}
void loop() {
int Vo; // Integer value of voltage reading
float R = 9870.0; // Fixed resistance in the voltage divider
float logRt,Rt,T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
Vo = analogRead(ThermistorPin); // Reading voltage Thermistor Reading pin
Rt = R*( 1023.0 / (float)Vo - 1.0 );
logRt = log(Rt);
T = ( 1.0 / (c1 + c2*logRt + c3*logRt*logRt*logRt ) ) - 273.15; // Converting voltage to temperature
Serial.print(" "); Serial.print(T); // Printing data to Serial Monitor
Serial.print(" "); Serial.print(LDRReading);
// Setting the colours of the RGB LED based on temperature,
// Colour is shown for 0.1s before checking temperature again.
if(T >= 26.2)
{
digitalWrite(redPin, HIGH); // red
delay(100);
digitalWrite(grnPin, LOW);
digitalWrite(bluPin, LOW);
}
if((T < 26) && (T >= 23.2))
{
digitalWrite(redPin, HIGH); // yellow
digitalWrite(grnPin, HIGH);
delay(100);
digitalWrite(bluPin, LOW);
}
if((T < 23) && (T > 20.2))
{
digitalWrite(grnPin, HIGH); // green
delay(100);
digitalWrite(redPin, LOW);
digitalWrite(bluPin, LOW);
}
if((T < 20) && (T > 17.2))
{
digitalWrite(grnPin, HIGH); // aqua
digitalWrite(bluPin, HIGH);
delay(100);
digitalWrite(redPin, LOW);
}
if(T <= 17)
{
digitalWrite(bluPin, HIGH); // blue
delay(100);
digitalWrite(grnPin, LOW);
digitalWrite(redPin, LOW);
}
row++; // For PLX-DAQ
x++; // For PLX-DAQ
delay(1000); // Printing data once a second
}
Thursday, 12 June 2014
Arduino with a thermistor, LDR and RGB LED that changes colour with temperature
Code gets:
- Temperature from a thermistor
- Light value from an LDR
and
RGB LED changes colour depending on the Temperature
Prints the data to the Serial Monitor
Please let me know if you experience any problems with this
code. Be sure to check back for more Arduino code.
Schematic:
Code:
/*
Oliver Holden
Created 28/10/2014
Components:
* Arduino UNO
* Thermistor
* 10K resistor
* LDR
* 10K resistor
* RGB LED
* 3x 220 ohm resistors
- Gets Temperature form a Thermistor
- Gets an analogue value of Light from an LDR
- RGB LED changes colour depending on the Temperature
Prints the data to the Serial Monitor
Schematic for this project is on
http://electrical-teen.blogspot.co.uk/
*/
int redPin = 11; // Red LED, connected to digital pin 11
int grnPin = 10; // Green LED, connected to digital pin 10
int bluPin = 9; // Blue LED, connected to digital pin 9
int ThermistorPin = A0; // Thermistor Reading pin
int LDRPin= A2; // LDR Reading pin
int LDRReading = analogRead(LDRPin); // Reading LDR analogue value
void setup()
{
Serial.begin(9600); // Opening serial connection at 9600bps
Serial.println("Thermistor temperature and LDR light measurement:"); // Printing Serial Monitor header
Serial.println(" T (C), LDR"); // Setting headers of colums in PLX-DAQ spreadsheet
Serial.println("\n-----------------------------");
pinMode(redPin, OUTPUT); // sets the LED pins as output
pinMode(grnPin, OUTPUT);
pinMode(bluPin, OUTPUT);
}
void loop() {
int Vo; // Integer value of voltage reading
float R = 9870.0; // Fixed resistance in the voltage divider
float logRt,Rt,T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
Vo = analogRead(ThermistorPin); // Reading voltage Thermistor Reading pin
Rt = R*( 1023.0 / (float)Vo - 1.0 );
logRt = log(Rt);
T = ( 1.0 / (c1 + c2*logRt + c3*logRt*logRt*logRt ) ) - 273.15; // Converting voltage to temperature
Serial.print(" "); Serial.print(T); // Printing data to Serial Monitor
Serial.print(" "); Serial.print(LDRReading);
// Setting the colours of the RGB LED based on temperature,
// Colour is shown for 0.1s before checking temperature again.
if(T >= 26.2)
{
digitalWrite(redPin, HIGH); // red
delay(100);
digitalWrite(grnPin, LOW);
digitalWrite(bluPin, LOW);
}
if((T < 26) && (T >= 23.2))
{
digitalWrite(redPin, HIGH); // yellow
digitalWrite(grnPin, HIGH);
delay(100);
digitalWrite(bluPin, LOW);
}
if((T < 23) && (T > 20.2))
{
digitalWrite(grnPin, HIGH); // green
delay(100);
digitalWrite(redPin, LOW);
digitalWrite(bluPin, LOW);
}
if((T < 20) && (T > 17.2))
{
digitalWrite(grnPin, HIGH); // aqua
digitalWrite(bluPin, HIGH);
delay(100);
digitalWrite(redPin, LOW);
}
if(T <= 17)
{
digitalWrite(bluPin, HIGH); // blue
delay(100);
digitalWrite(grnPin, LOW);
digitalWrite(redPin, LOW);
}
delay(1000); // Printing data once a second
}
Thursday, 5 June 2014
Arduino with a thermistor and LDR to get temperature and light value - prints data to PLX-DAQ Excel spreadsheet
Code gets:
- Temperature from a thermistor
- Light value from an LDR
and
Prints the data to the Serial Monitor
Data is sent to an Excel spreadsheet through data
acquisition software, PLX-DAQ, Download here
Please let me know if you experience any problems with this
code. Be sure to check back for more Arduino code.
Schematic:
Code:
/*
Oliver Holden
Created 28/10/2014
Components:
* Arduino UNO
* Thermistor
* 10K resistor
* LDR
* 10K resistor
- Gets Temperature form a Thermistor
- Gets an analogue value of Light from an LDR
Prints the data to the Serial Monitor
Data is sent to an Excel spreadsheet through data
acquisition software, PLX-DAQ, Download http://www.parallax.com/downloads/plx-daq
Schematic for this project is on
http://electrical-teen.blogspot.co.uk/
*/
int ThermistorPin = A0; // Thermistor Reading pin
int LDRPin= A2; // LDR Reading pin
int LDRReading = analogRead(LDRPin); // Reading LDR analogue value
int x = 0; // For PLX-DAQ
int row = 0; // For PLX-DAQ
void setup()
{
Serial.begin(9600); // Opening serial connection at 9600bps
Serial.println("Thermistor temperature and LDR light measurement:"); // Printing Serial Monitor header
Serial.println("LABEL, Time, T (C), LDR"); // Setting headers of colums in PLX-DAQ spreadsheet
Serial.println("\n-----------------------------");
}
void loop() {
int Vo; // Integer value of voltage reading
float R = 9870.0; // Fixed resistance in the voltage divider
float logRt,Rt,T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
Vo = analogRead(ThermistorPin); // Reading voltage Thermistor Reading pin
Rt = R*( 1023.0 / (float)Vo - 1.0 );
logRt = log(Rt);
T = ( 1.0 / (c1 + c2*logRt + c3*logRt*logRt*logRt ) ) - 273.15; // Converting voltage to temperature
Serial.print(" "); Serial.print(T); // Printing data to Serial Monitor
Serial.print(" "); Serial.print(LDRReading);
row++; // For PLX-DAQ
x++; // For PLX-DAQ
delay(1000); // Printing data once a second
}
Thursday, 29 May 2014
Arduino with a Thermistor and LDR to get temperature and light value
Code gets:
- Temperature from a thermistor
- Light value from an LDR
and
Prints the data to the Serial Monitor
Please let me know if you experience any problems with this
code. Be sure to check back for more Arduino code.
Schematic:
Code:
/*
Oliver Holden
Created 28/10/2014
Components:
* Arduino UNO
* Thermistor
* 10K resistor
* LDR
* 10K resistor
- Gets Temperature form a Thermistor
- Gets an analogue value of Light from an LDR
Prints the data to the Serial Monitor
Schematic for this project is on
http://electrical-teen.blogspot.co.uk/
*/
int ThermistorPin = A0; // Thermistor Reading pin
int LDRPin= A2; // LDR Reading pin
int LDRReading = analogRead(LDRPin); // Reading LDR analogue value
void setup()
{
Serial.begin(9600); // Opening serial connection at 9600bps
Serial.println("Thermistor temperature and LDR light measurement:"); // Printing Serial Monitor header
Serial.println(" T (C), LDR"); // Setting headers of colums in PLX-DAQ spreadsheet
Serial.println("\n-----------------------------");
}
void loop() {
int Vo; // Integer value of voltage reading
float R = 9870.0; // Fixed resistance in the voltage divider
float logRt,Rt,T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
Vo = analogRead(ThermistorPin); // Reading voltage Thermistor Reading pin
Rt = R*( 1023.0 / (float)Vo - 1.0 );
logRt = log(Rt);
T = ( 1.0 / (c1 + c2*logRt + c3*logRt*logRt*logRt ) ) - 273.15; // Converting voltage to temperature
Serial.print(" "); Serial.print(T); // Printing data to Serial Monitor
Serial.print(" "); Serial.print(LDRReading);
delay(1000); // Printing data once a second
}
Thursday, 22 May 2014
Arduino with a thermistor and RGB LED - PLX-DAQ Excel spreadsheet
Code gets:
- Temperature from a thermistor
and
RGB LED changes
colour depending on the Temperature
Prints the data to the Serial Monitor
Data is sent to an Excel spreadsheet through data
acquisition software, PLX-DAQ, Download here
Please let me know if you experience any problems with this
code. Be sure to check back for more Arduino code.
Schematic:
Code:
/*
Oliver Holden
Created 28/10/2014
Components:
* Arduino UNO
* Thermistor
* 10K resistor
* RGB LED
* 3x 220 ohm resistors
- Gets Temperature form a Thermistor
- RGB LED changes colour depending on the Temperature
Prints the data to the Serial Monitor
Data is sent to an Excel spreadsheet through data
acquisition software, PLX-DAQ, Download http://www.parallax.com/downloads/plx-daq
Schematic for this project is on
http://electrical-teen.blogspot.co.uk/
*/
int redPin = 11; // Red Leg of LED, connected to digital pin 11
int grnPin = 10; // Green Leg of LED, connected to digital pin 10
int bluPin = 9; // Blue Leg of LED, connected to digital pin 9
int ThermistorPin = A0; // Thermistor Reading pin
void setup()
{
Serial.begin(9600); // Opening serial connection at 9600bps
Serial.println("Thermistor temperature measurement:"); // Printing Serial Monitor header
Serial.println("\n Vo Rt T (C)");
pinMode(redPin, OUTPUT); // Sets the LED pins as outputs
pinMode(grnPin, OUTPUT);
pinMode(bluPin, OUTPUT);
}
void loop() {
int Vo; // Integer value of voltage reading
float R = 9870.0; // Fixed resistance in the voltage divider
float logRt,Rt,T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
Vo = analogRead(ThermistorPin); // Reading voltage of Thermistor Reading pin
Rt = R*( 1023.0 / (float)Vo - 1.0 );
logRt = log(Rt);
T = ( 1.0 / (c1 + c2*logRt + c3*logRt*logRt*logRt ) ) - 273.15; // converting voltage to temperature
Serial.print(" "); Serial.print(Vo); // Printing data to Serial Monitor
Serial.print(" "); Serial.print(Rt);
Serial.print(" "); Serial.println(T);
// Setting the colours of the RGB LED based on temperature,
// Colour is shown for 0.1s before checking temperature again.
if(T >= 26.2)
{
digitalWrite(redPin, HIGH); // red
delay(100);
digitalWrite(grnPin, LOW);
digitalWrite(bluPin, LOW);
}
if((T < 26) && (T >= 23.2))
{
digitalWrite(redPin, HIGH); // yellow
digitalWrite(grnPin, HIGH);
delay(100);
digitalWrite(bluPin, LOW);
}
if((T < 23) && (T > 20.2))
{
digitalWrite(grnPin, HIGH); // green
delay(100);
digitalWrite(redPin, LOW);
digitalWrite(bluPin, LOW);
}
if((T < 20) && (T > 17.2))
{
digitalWrite(grnPin, HIGH); // aqua
digitalWrite(bluPin, HIGH);
delay(100);
digitalWrite(redPin, LOW);
}
if(T <= 17)
{
digitalWrite(bluPin, HIGH); // blue
delay(100);
digitalWrite(grnPin, LOW);
digitalWrite(redPin, LOW);
}
}
Thursday, 15 May 2014
Arduino with a thermistor and RGB LED
Code gets:
- Temperature from a thermistor
and
RGB LED changes
colour depending on the Temperature
Prints the data to the Serial Monitor
Please let me know if you experience any problems with this
code. Be sure to check back for more Arduino code.
Schematic:
Code:
/*
Oliver Holden
Created 28/10/2014
Components:
* Arduino UNO
* Thermistor
* 10K resistor
* RGB LED
* 3x 220 ohm resistors
- Gets Temperature form a Thermistor
- RGB LED changes colour depending on the Temperature
Prints the data to the Serial Monitor
Schematic for this project is on
http://electrical-teen.blogspot.co.uk/
*/
int redPin = 11; // Red Leg of LED, connected to digital pin 11
int grnPin = 10; // Green Leg of LED, connected to digital pin 10
int bluPin = 9; // Blue Leg of LED, connected to digital pin 9
int ThermistorPin = A0; // Thermistor Reading pin
void setup()
{
Serial.begin(9600); // Opening serial connection at 9600bps
Serial.println("Thermistor temperature measurement:"); // Printing Serial Monitor header
Serial.println("\n Vo Rt T (C)");
pinMode(redPin, OUTPUT); // Sets the LED pins as outputs
pinMode(grnPin, OUTPUT);
pinMode(bluPin, OUTPUT);
}
void loop() {
int Vo; // Integer value of voltage reading
float R = 9870.0; // Fixed resistance in the voltage divider
float logRt,Rt,T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
Vo = analogRead(ThermistorPin); // Reading voltage of Thermistor Reading pin
Rt = R*( 1023.0 / (float)Vo - 1.0 );
logRt = log(Rt);
T = ( 1.0 / (c1 + c2*logRt + c3*logRt*logRt*logRt ) ) - 273.15; // converting voltage to temperature
Serial.print(" "); Serial.print(Vo); // Printing data to Serial Monitor
Serial.print(" "); Serial.print(Rt);
Serial.print(" "); Serial.println(T);
// Setting the colours of the RGB LED based on temperature,
// Colour is shown for 0.1s before checking temperature again.
if(T >= 26.2)
{
digitalWrite(redPin, HIGH); // red
delay(100);
digitalWrite(grnPin, LOW);
digitalWrite(bluPin, LOW);
}
if((T < 26) && (T >= 23.2))
{
digitalWrite(redPin, HIGH); // yellow
digitalWrite(grnPin, HIGH);
delay(100);
digitalWrite(bluPin, LOW);
}
if((T < 23) && (T > 20.2))
{
digitalWrite(grnPin, HIGH); // green
delay(100);
digitalWrite(redPin, LOW);
digitalWrite(bluPin, LOW);
}
if((T < 20) && (T > 17.2))
{
digitalWrite(grnPin, HIGH); // aqua
digitalWrite(bluPin, HIGH);
delay(100);
digitalWrite(redPin, LOW);
}
if(T <= 17)
{
digitalWrite(bluPin, HIGH); // blue
delay(100);
digitalWrite(grnPin, LOW);
digitalWrite(redPin, LOW);
}
}
Thursday, 8 May 2014
RGB LED that changes colour every 0.1s - you can set the colours, order and duration
Basic code to create a flashing RGB LED that changes colour.
Please let me know if you experience any problems with this
code. Be sure to check back for more Arduino code.
Schematic:
Code:
/*
Oliver Holden
Created 28/10/2014
Components:
* Arduino UNO
* RGB LED
* 3x 220 ohm resistors
- RGB changes colour every 0.1s
Schematic for this project is on
http://electrical-teen.blogspot.co.uk/
*/
int redPin = 11; // Red LED, connected to digital pin 11
int grnPin = 10; // Green LED, connected to digital pin 10
int bluPin = 9; // Blue LED, connected to digital pin 9
void setup()
{
pinMode(redPin, OUTPUT); // Setting LED pins as outputs
pinMode(grnPin, OUTPUT);
pinMode(bluPin, OUTPUT);
}
void loop()
{
setColor(255, 0, 0); // red // Going through different colours
delay(100); // Each colour is on for 100ms
setColor(0, 255, 0); // green
delay(100);
setColor(0, 0, 255); // blue
delay(100);
setColor(255, 255, 0); // yellow
delay(100);
setColor(80, 0, 80); // purple
delay(100);
setColor(0, 255, 255); // aqua
delay(100);
}
void setColor(int red, int green, int blue) // Setting colours
{
analogWrite(redPin, red);
analogWrite(grnPin, green);
analogWrite(bluPin, blue);
}
Thursday, 1 May 2014
Arduino with RGB LED to create any colour you want
Basic code to create an LED of any colour from an RGB LED.
Please let me know if you experience any problems with this
code. Be sure to check back for more Arduino code.
Schematic:
Code:
/*
Oliver Holden
Created 28/10/2014
Components:
* Arduino UNO
* RGB LED
* 3x 220 ohm resistors
- Create an LED that can dispaly any colour you want
Schematic for this project is on
http://electrical-teen.blogspot.co.uk/
*/
int redPin = 11; // Red LED, connected to digital pin 11
int grnPin = 10; // Green LED, connected to digital pin 10
int bluPin = 9; // Blue LED, connected to digital pin 9
void setup()
{
pinMode(redPin, OUTPUT); // Setting LED pins as outputs
pinMode(grnPin, OUTPUT);
pinMode(bluPin, OUTPUT);
}
void loop()
{
setColor(255, 255, 255); // (R,G,B) - change the numbers to a value between 0 and 255
}
void setColor(int red, int green, int blue) // Setting colours
{
analogWrite(redPin, red);
analogWrite(grnPin, green);
analogWrite(bluPin, blue);
}
Thursday, 24 April 2014
Arduino with a LDR - PLX-DAQ Excel spreadsheet
Arduino circuit with an LDR to get an analogue value of light, prints data to Serial Monitor and PLX-DAQ Excel spreadsheet.
Schematic:
Code:
Please let me know if you experience any problems with this
code. Be sure to check back for more Arduino code.
Schematic:
Code:
/*
Oliver Holden
Created 28/10/2014
Components:
* Arduino UNO
* LDR
* 10K resistor
- Gets an analogue value of Light from an LDR
Prints the data to the Serial Monitor
Data is sent to an Excel spreadsheet through data
acquisition software, PLX-DAQ, Download http://www.parallax.com/downloads/plx-daq
Schematic for this project is on
http://electrical-teen.blogspot.co.uk/
*/
int LDRPin= A2; // LDR Reading Pin
int LDRReading = analogRead(LDRPin); // Reading analogue value from LDR
int x = 0; // For PLX-DAQ
int row = 0; // For PLX-DAQ
void setup()
{
Serial.begin(9600); // Opening serial connection at 9600bps
Serial.println("Light"); //Printing Serial Monitor header
Serial.println("LABEL, Time, LDR"); // Setting headers of colums in PLX-DAQ spreadsheet
Serial.println("\n-----------------");
}
void loop() {
Serial.println(LDRReading); // Printing data to Serial Monitor
row++; // For PLX-DAQ
x++; // For PLX-DAQ
delay(1000); // Printing data once a second
}
Thursday, 17 April 2014
Arduino with a LDR
Arduino circuit with an LDR to get an analogue value of light, prints data to Serial Monitor.
Please let me know if you experience any problems with this
code. Be sure to check back for more Arduino code.
Schematic:
Code:
/*
Oliver Holden
Created 28/10/2014
Components:
* Arduino UNO
* LDR
* 10K resistor
- Gets an analogue value of Light from an LDR
Prints the data to the Serial Monitor
Schematic for this project is on
http://electrical-teen.blogspot.co.uk/
*/
int LDRPin= A2; // LDR Reading Pin
int LDRReading = analogRead(LDRPin); // Reading analogue value from LDR
void setup()
{
Serial.begin(9600); // Opening serial connection at 9600bps
Serial.println("Light"); //Printing Serial Monitor header
Serial.println("\n-----------------");
}
void loop() {
Serial.println(LDRReading); // Printing data to Serial Monitor
delay(1000); // Printing data once a second
}
Arduino with a thermistor to get temperature - PLX-DAQ Excel spreadsheet
Simple Arduino circuit to get temperature from a thermistor, prints data to Serial Monitor and PLX-DAQ Excel spreadsheet.
Please let me know if you experience any problems with this
code. Be sure to check back for more Arduino code.
Schematic:
Code:
/*
Oliver Holden
Created 28/10/2014
Components:
* Arduino UNO
* Thermistor
* 10K resistor
- Gets Temperature form a Thermistor
Prints the data to the Serial Monitor
Data is sent to an Excel spreadsheet through data
acquisition software, PLX-DAQ, Download http://www.parallax.com/downloads/plx-daq
Schematic for this project is on
http://electrical-teen.blogspot.co.uk/
*/
int ThermistorPin = A0; // Thermister Reading pin
int x = 0; // For PLX-DAQ
int row = 0; // For PLX-DAQ
void setup()
{
Serial.begin(9600); // Opening serial connection at 9600bps
Serial.println("Thermistor temperature measurement:"); // Printing Serial Monitor header
Serial.println("LABEL, Time, Vo, Rt, T (C)"); // Setting headers of colums in PLX-DAQ spreadsheet
Serial.println("\n Vo Rt T (C)");
}
void loop() {
int Vo;
float R = 9870.0; // Fixed resistance in the voltage divider
float logRt,Rt,T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
Vo = analogRead(ThermistorPin); // Reading voltage of Thermistor Reading pin
Rt = R*( 1023.0 / (float)Vo - 1.0 );
logRt = log(Rt);
T = ( 1.0 / (c1 + c2*logRt + c3*logRt*logRt*logRt ) ) - 273.15; // Convertion to get temperature from thermistor
Serial.print(" "); Serial.print(Vo); // Printing data to Serial Monitor
Serial.print(" "); Serial.print(Rt);
Serial.print(" "); Serial.println(T);
row++; // For PLX-DAQ
x++; // For PLX-DAQ
delay(1000); // Printing data once per second
}
Thursday, 10 April 2014
Arduino with a thermistor to get temperature
Simple Arduino circuit to get temperature from a simple thermistor, prints data to Serial Monitor.
Please let me know if you experience any problems with this
code. Be sure to check back for more Arduino code.
Schematic:
Code:
/*
Oliver Holden
Created 28/10/2014
Components:
* Arduino UNO
* Thermistor
* 10K resistor
- Gets Temperature form a Thermistor
Prints the data to the Serial Monitor
Schematic for this project is on
http://teenengineer.blogspot.co.uk/
*/
int ThermistorPin = A0; // Thermister Reading pin
void setup()
{
Serial.begin(9600); // Opening serial connection at 9600bps
Serial.println("Thermistor temperature measurement:"); // Printing Serial Monitor header
Serial.println("\n Vo Rt T (C)");
}
void loop() {
int Vo; // Integer value of voltage reading
float R = 9870.0; // Fixed resistance in the voltage divider
float logRt,Rt,T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
Vo = analogRead(ThermistorPin); // Reading voltage of Thermistor Reading pin
Rt = R*( 1023.0 / (float)Vo - 1.0 );
logRt = log(Rt);
T = ( 1.0 / (c1 + c2*logRt + c3*logRt*logRt*logRt ) ) - 273.15; // Convertion to get temperature from thermistor
Serial.print(" "); Serial.print(Vo); // Printing data to Serial Monitor
Serial.print(" "); Serial.print(Rt);
Serial.print(" "); Serial.println(T);
delay(1000); // Printing data once per second
}
Subscribe to:
Posts (Atom)






