Loading...
  Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Programming Questions / Re: Strange behaviour when reading button on: May 14, 2013, 06:59:17 pm
@Erdin - I am using 10K pullups. I am using breadboard, I have tried 2 different switches with the same result.
I'll try moving to a different part of the breadboard.

@sparkfuntoday - I was getting the error before I added the delay, I only added it to more easily see what was happening in the Serial Window

Edit - HA! I checked with my meter and it indicated that it should be working, so I tried replacing the ATmega328P.
Success!!
2  Using Arduino / Programming Questions / Strange behaviour when reading button on: May 14, 2013, 05:43:02 pm
Hi everyone,
I was getting some strange behaviour when reading a button as part of a larger sketch, so I tried removing the button reading part of the sketch to rule out other parts of the sketch possibly interfering.

The button is active LOW (ie-normally pulled to +5V, when button is pressed it is pulled to GND).

So when I press the button it acknowledges the button press/hold but only for about 3 seconds, regardless of how long I hold the button.

Can anyone pls tell me what silly mistake I am making?

Code:

int buttonPin = 9;  // button is active LOW connected to Digital Pin 9
int buttonState;// = HIGH;  // variable for storing state of buttonPin


 
void setup() {
  pinMode(buttonPin, INPUT);
  Serial.begin(9600);
}


void loop() {
  buttonState = digitalRead(buttonPin);
  
  if (buttonState == LOW) {
    Serial.println("Button Pressed");
  }else if (buttonState == HIGH) {
    Serial.println("Button Released");
 
  }  
    
   delay(500);
  
}
  
3  Using Arduino / Displays / Re: Using HD44780 LCD with Arduino analog pins. on: May 12, 2013, 10:36:00 pm
Quote
I believe that LiquidCrystal lcd(A0, A1, A2, A3, A4, A5); should have worked, but you could also try LiquidCrystal lcd(14, 15, 16, 17, 18, 19);.[/color]

I hope you didn't forget to ground LCD pin 5 when you reworked your circuit.

Don




I removed the pinMode extra code with no change.

Turned out it worked with LiquidCrystal lcd(14, 15, 16, 17, 18, 19);

It didn't like the LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);

Thank you for your help!
4  Using Arduino / Displays / Using HD44780 LCD with Arduino analog pins. on: May 12, 2013, 09:31:10 pm
Hi everyone,
I am working on a project that has used up almost all of my digital I/O pins. I read in the playground that the Analog Input pins can be used as digital I/O as well.
So I modified the LCD "Hello World" sketch to use the pins Analog0 through to Analog5.
However I am not getting any text on the LCD

I suspect it is something do do with configuring the Analog Pins as Digital Outputs, but I am not knowledgeable enough to know what to do.

Any help would be greatly appreciated

Here is the modified code
Code:
/*

  The circuit:
 * LCD RS pin to digital pin A0
 * LCD Enable pin to digital pin A1
 * LCD D4 pin to digital pin A2
 * LCD D5 pin to digital pin A3
 * LCD D6 pin to digital pin A4
 * LCD D7 pin to digital pin A5
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 
 
 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

// include the library code:
#include <LiquidCrystal.h>

int A0,A1,A2,A3,A4,A5;

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);

void setup() {
 
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  pinMode(A4, OUTPUT);
  pinMode(A5, OUTPUT);
  // set up the LCD's number of rows and columns:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}
5  Using Arduino / Displays / LCD HD44780 backlight blinking on: May 07, 2013, 11:35:16 am
Hi everyone,
I have a LCD HD44780 where the backlight is blinking. I havent used any code yet, just applied +5V to pins 2 and 15. GND is connected to pins 1 and 16.
Could a lack of a series resistor for the LED backlight cause this? Or is it likely just a bad unit?
Unfortunately I only have 1 LCD, so I can't swap it out to see if it just the unit.
6  Using Arduino / Project Guidance / Re: PID ramp soak question on: December 17, 2012, 05:37:16 pm
Quote
Is it actually necessary to ramp when toasting coffee? I'd expect that you would heat the roaster to the desired temperature, then add the beans and hold it at temp for the roasting time. Is there some advantage to a gradual rise?

Yes, the roaster needs to be preheated, then when the beans are added the roaster temp drops. Then the temp needs to be gradually ramped up until first crack occurs and dependent on the roast level required, ramped up to 2nd crack.


Ok, I think I am understanding it now. Say for example I wanted the setpoint to shift once each second as a standard thing. By looking at the desired ramp rate, I could easily calculate the size of the setpoint shift each second and tell the Arduino to do that.

Am I on the right track now? Btw thank you all for your help!  smiley
7  Using Arduino / Project Guidance / Re: PID ramp soak question on: December 17, 2012, 05:34:01 am
Quote
Which just leaves #2.  Do you expect the Arduino to have to recover from a power loss?

No as I will be there monitoring the process.

Quote
Huh?

My current understanding of a ramp soak controller is a PID controller with a moving setpoint. So if the setpoint is moving (at a desired rate) would I need to know the time taken for a loop to be executed, in order to work out what the increment would need to be each time the loop function is executed to stay at the desired ramp rate?

8  Using Arduino / Project Guidance / PID ramp soak question on: December 17, 2012, 04:56:24 am
Hi everyone,
I have been working on a PID project for a while that is now working pretty well (home espresso). Now I want to build a roast controller, but am unsure how to approach the moving setpoint part.

Would I need a RTC to keep track of time, or is it sufficient to use millis() ?

If millis() is sufficient would I need to figure out the time taken for a single loop to be executed and then calculate how much the setpoint needs to shift each loop?

Thanks in advance for any advice, I'm having quite a bit of difficulty getting my head around this  smiley
9  Community / Products and Services / Re: Fetch: Arduino Development Tool on: December 10, 2012, 12:45:32 am
Looking forward to using this software with my Due. Good work Drl81!
10  Using Arduino / Programming Questions / Re: Using an array to smooth double variable types? on: November 21, 2012, 12:15:55 pm
Thank you all!
I think runningAverage will suit my purposes.
11  Using Arduino / Programming Questions / Using an array to smooth double variable types? on: November 20, 2012, 01:56:54 pm
Hi All,
I am reading from a thermocouple with the MAX31855 chip using double variable type for greater precision.
I want to smooth the readings coming from the thermocouple.
I found Smooth & digitalSmooth functions in the playground to do this, but it seems these have been written for int variable types only (ie- reading analog sensor)

When I change the sensor reading variable to a double (in order to read the thermocouple with precision), the smoothing by the array results in integers.

Is there a way to make the array work with double variable types, or is there a different function that I have not yet discovered?
12  Using Arduino / Sensors / Re: MAX31855 problems on: July 11, 2012, 12:05:55 pm
Thank you for your extensive reply Doc.

This was my first attempt at creating a PCB, so I had (it seems mistakenly) thought that merging a few working schematics (and existing working, separate but wired together boards) would be a good place to start. To keep things simple I used the auto router in Eagle.

I have checked power supply to all chips (tested OK), I have checked all GNDs are connected (tested OK).

I can't see a 470uF capacitor anywhere on the schematic, so that confused me a bit.
When you say "By-pass caps work best when spread about the board carefully", is that to reduce noise issues?

I am currently working my way through the netlist.

I must say this is a great learning experience!

13  Using Arduino / Sensors / Re: MAX31855 problems on: July 10, 2012, 07:21:40 pm
Docedison,
the 3V3 regulator is from the max31855 breakout board schematic from Adafruit. I have attached an image of the max31855 breakout schematic.

From your previous comments, does that mean this schematic is incorrect?
14  Using Arduino / Sensors / Re: MAX31855 problems on: July 10, 2012, 06:31:47 pm
Docedison,
No I did not breadboard it, but I did have a MAX31855 breakout board from Adafruit and a RBBB Arduino clone, plus my own 4 button keyboard and transistor output for a SSR, all working together. So I merged the designs together into a single board.

CrossRoads, I based the code I am using from Adafruits example, except I am displaying on a LCD.
The original example is here
Code:
/***************************************************
  This is an example for the Adafruit Thermocouple Sensor w/MAX31855K

  Designed specifically to work with the Adafruit Thermocouple Sensor
  ----> https://www.adafruit.com/products/269

  These displays use SPI to communicate, 3 pins are required to 
  interface
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries. 
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include "Adafruit_MAX31855.h"

int thermoDO = 3;
int thermoCS = 4;
int thermoCLK = 5;

Adafruit_MAX31855 thermocouple(thermoCLK, thermoCS, thermoDO);
 
void setup() {
  Serial.begin(9600);
 
  Serial.println("MAX31855 test");
  // wait for MAX chip to stabilize
  delay(500);
}

void loop() {
  // basic readout test, just print the current temp
   Serial.print("Internal Temp = ");
   Serial.println(thermocouple.readInternal());

   double c = thermocouple.readCelsius();
   if (isnan(c)) {
     Serial.println("Something wrong with thermocouple!");
   } else {
     Serial.print("C = ");
     Serial.println(c);
   }
   //Serial.print("F = ");
   //Serial.println(thermocouple.readFarenheit());
 
   delay(1000);
}
15  Using Arduino / Sensors / Re: MAX31855 problems on: July 10, 2012, 06:04:28 pm
Still the same I'm afraid  smiley-confuse
Pages: [1] 2 3 4