Search This Blog

Translate

Thursday, 18 September 2014

Bluetooth module for PS3 control of a 3D printer

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.

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.

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.

Thursday, 21 August 2014

Auto bed levelling for RepRap Prusa Mendel i2

I have heard a lot of people in the RepRap community talking about how they have set up auto bed levelling, however most of the designs they use are for use on a RepRap Prusa i3. So I thought I would share with you my 3d printed design to hold the servo and z probe end stop. So here are the two designs: http://www.thingiverse.com/thing:432232.

I then followed this tutorial:

Part One: http://zennmaster.com/random-things/auto-bed-leveling-for-the-makerfarm-prusa-i3-part-1-assembly-and-basic-setup

Part Two: http://zennmaster.com/random-things/auto-bed-leveling-for-the-makerfarm-prusa-i3-part-2-setting-up-marlin

Part Three: http://zennmaster.com/random-things/auto-bed-leveling-for-the-makerfarm-prusa-i3-part-3-final-setup

This is for an i3 but the setup is very similar! Please see Thingiverse link for pictures and feel free to ask any questions you may have.

Thursday, 14 August 2014

RepRap 3Dprinter stepper calibration - not printing desired lengths

After you have uploaded Marlin you need to calibrate a few things, X Y Z and Extruder stepper motors and making sure the bed is level.

To calibrate the stepper motors see the video below, this video is for the Extruder however the same theory applies to the other stepper motors.

https://www.youtube.com/watch?v=w_Wb0i0-Qvo&list=FLsBw9MazlOn_-0v7O8OSgwg&index=7

For X and Y find a reference point on the side of the x carriage or front of the Y frame take a measurement to the extruder module or the front of the bed. Then in Pronterface of Repetier host move the axis by 50mm and then see how far the extruder module or the bed actually moves. Next, find you current E-steps in marlin under the configuration.h file and make a note.

Then use this equation  (expected distance / actual distance) * current steps per mm = new steps.
so if I asked X to move 10mm and it only moved 7 I would do 10/2 = 5 then find my current steps per mm for the X axis and times it by 5.

This works for the Z axis as well.

Then enter the new E-steps into Marlin, upload and save. You can also alter the E-steps on a lcd and save to eprom if you have this enabled. On the LCD go to Control => Motion and scroll down to Xsteps, Ysteps, Zsteps and Esteps. Click on then and change the value accordingly. Then go back to the control menu and click save. This saves the steps for each axis.

Thursday, 7 August 2014

My second print - warping issues with ABS


So yesterday I tried my first print which went ok but I know these machines can produce a lot better quality. So after making the adjustments that I mentioned yesterday ( raising the hot end slightly more and setting infill to 100%.

This worked really well, or so I thought! I watched the first few layers which were perfect and left it for 20 minutes or so and came back when it had finished. I found that one of the corners had lifted up of the surface of the bed probably about half way through. After a bit of research I found out that ABS is susceptible to bad warping which means the corners of prints don't stick down to the bed too well and so they curl up away from the bed.




This picture shows the layers curling up at the corner.

There are several solutions to this problem that might work:

- clean the bed to get rid of any residue especially oil or finger marks

- make sure the bed is hot enough ( around 100 degrees C for ABS) to make sure the first layer sticks to the bed properly

- make sure the bed is level, if not one corner/ side could be lower than the others so the filament doesn't stick to the bed as well as the other corners.

I think that my problem was that the bed wasn't level as like I said in the previous post I hadn't done any calibration on my printer.


Thursday, 31 July 2014

RepRap Prusa Mendel i2 first print! - layers squashed

My printer arrived 2 days ago and I was unable to print as I had to wait for my order of kapton tape to arrive ( this was quite essential as the filament that came with the printer was ABS ).

Once the tape arrived I designed a simple 20x20x10mm box and tried to print it, link to the file on thingiverse: http://www.thingiverse.com/thing:415902.

I stupidly thought it was a good idea to try a print before I had done any calibration at all! any way it turned out as I had expected, not very good but not to bad. Here are the pictures:




As you can see there is no clear definition of the layers and the edges are very rough. Also the print has lost its shape as the corners are very rounded. This has happened because the hot end was too close to the print bed and so the extruded filament got squashed down on top of each other. This caused some of the filament to be squashed out of the supposed size of the object. In other words an extra .2 mm of filament on each side due to not enough room for layer to be laid down. Therefore for my second print I need to make sure that I have the hot end a little bit further away from the bed.


This picture shows that I had Slicer configured wrong because it printed out a hollow box but then for 3 of the top layers it tried to do a solid layer. This result in the filament sagging into the hollow box bellow. So for my second print I will set the infill to 100% or 1 if using Repetier host.


Thursday, 24 July 2014

Z axis jarring problems on RepRap Prusa Mendel i2.

After a few days of using my 3D printer, I found a problem, the Z axis would jar on the right hand side causing one side to be higher than the other and then both sides would jar as a result of the X axis not being level.


When this happened I notice that I could move the right hand side of the X carriage up and down and sometimes the nuts on the X carriage would be "left behind". this meant the X carriage would no longer be raised up and you could also move the X carriage up and down on the side that jarred because the nuts ( one on the top and one on the bottom of the plastic part that joins to the threaded rod ) would no longer be pressed tight against the plastic part.

I thought that this problem was because the X carriage wasn't level in the first place as I hadn't checked it. So I levelled the bed making sure the distance D on the diagram was the same on both sides ( see image below ). However when I checked it was level and put the nut back into place I kept on getting the same problem.

I then looked online to see if any one else had this problem, I found one post on the RepRap forums about the Z axis stepper motors vibrating and not turning and the solution was to reduce the speed of the two Z axis stepper motors. I tried this and it worked! I slowed mine down to about 50 mm/min in pronterface and the axis stopped jarring.

I also found other causes of jarring, jamming and vibrating Z axis, these are:

- over heated stepper motors
- damaged threaded rods
- something has got caught in the nut
- X carriage not straight

and my solution, slowing down of the stepper motors!

This problem was all to do with the force that the stepper motor needed to exert to turn the Z axis was to great and so it was missing steps, stopped rotating the axis. therefore anything to stop forces building up would help. things like cleaning and lubricating the smooth and threaded rods would help reduce friction etc...

Here is the video of the Z axis jarring:



Please correct me if anything I have said is wrong!, and please message me if you found this useful or have any other suggestions :)

Thursday, 17 July 2014

Slic3r, pronterface and Repetier host

So now you have uploaded Malin to your Arduino mega, you are now ready to control your printer and make slight adjustments to you printer through Marlin.

There are two options that I would suggest,

Pronterface or Repetier host, these programmes are used to control your printer from your computer, you upload G code files to your printer through these programmes. Both are simple to use and there is well documented help on line as to how to set them up correctly, basically setting com port and baud rate and you good to go.

Before you print you need a design or file to print, you can download quite a few things on Thingiverse or you design your own products on free CAD software called Google sketch up and install the STL plugin which converts your design to a .STL file.

Once you have downloaded your STL file or created it you need to slice it into G-code. This creates your file as layers of X and Y movements to print the layers. To do this I would recommend Slic3r. Once you have slicer you need to go through all the settings and make sure these settings are correct for you printer. There is a great video below, this video goes through all the settings in Slic3r.


Thursday, 10 July 2014

How to setup an arduino Mega and upload Marlin

So I have been using Arduino's for quite a while before I got my 3D printer, when I saw the listing for this printer (as I got it on Ebay) I was thrilled to find out that it used an Arduino Mega. I thought great I might be able to add things into Marlin, I was wrong, the Marlin "sketch" was a lot more complicated than I thought (I didn't even know you could create tabs at the top of the page!).

Before my printer had arrived I had a look at the code and started to configure it for my printer that I had just bought. Setting up Marlin without any additional features is fairly straight forward as the sketch is very well commented so I managed to do it in about 10 minutes or so.

However if you aren't familiar with the Arduino language or how to set it up in the first place it can be quite frustrating.

The first thing you want to do is install the Arduino IDE, you can download it here: http://arduino.cc/en/Main/Software

Next you will need to install the driver for the Arduino Mega, the guide below is for an Arduino Uno but the process is very similar if not the same. 

Here is the guide: http://arduino.cc/en/guide/windows

Once you have installed both of these you can go ahead and download Marlin here: https://github.com/ErikZalm/Marlin



The Marlin firmware is down loaded as a .ZIP file so you will need to extract it, to do this, open the .ZIP file and at the top you will see a tab saying "Extract". Then click "extract all" and choose or create a folder for the files to be extracted to.

Once extracted you can now open the Arduino sketch, to do this, open up the Arduino IDE, go to File -> Open -> Marlin folder then select the Marlin.pde file.


This will then open the marlin sketch in the Arduino IDE so you can upload this to the Arduino mega board. To upload click the arrow button, right of the tick button.


However make sure you settings are correct in the configuration.h file before you try to print as it is very important to make sure the correct thermistor is being used to prevent overheating and stop a possible fire hazard. To open configuration.h file, open marlin in the Arduino IDE and you should see tabs across the top of the page. One of these will be the configuration.h file.

Also before you upload make sure the correct board is selected by going to tools => board and select the Arduino mega 2560. Also make sure the correct port is being used by going to tools => serial port and select one of the com ports.

Once this is done you can go ahead and open up and software that you prefer to use to control your 3D printer. I will be going over one of the most common programme used to control 3D printers in my next post.

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:


 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  
 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. 
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  
 }  
   

Contact Form

Name

Email *

Message *