Show Posts
Pages: [1] 2
1  Using Arduino / General Electronics / Re: Confused as to what will happen with multiple voltages on: December 30, 2012, 12:45:32 pm
I hope you are right (and that my simplified circuit is a sufficient analog of the real intended circuit!

You haven't said what your real intended circuit is, so we don't know whether that is true or not.

Fair point! The node (where we're measuring Vo) is the input to a Megasquirt EFI controller which normally measures the voltage across a potential divider (between the 2490Ohm resistor and a thermistor). I'm giving it a voltage feed from an Arduino instead (the software is taking the average of 4 thermistors and combining them into 1 output whilst also displaying all 4 on an LCD bargraph). It's more or less finished but probably needs a few tweaks
2  Using Arduino / General Electronics / Re: Confused as to what will happen with multiple voltages on: December 30, 2012, 12:13:12 pm
I hope you are right (and that my simplified circuit is a sufficient analog of the real intended circuit!
3  Using Arduino / General Electronics / Re: Confused as to what will happen with multiple voltages on: December 30, 2012, 10:36:13 am
If Vo = Vi then that's great. Thanks for all the replies - I think I'll breadboard it and hook up a DVM to check!
4  Using Arduino / General Electronics / Confused as to what will happen with multiple voltages on: December 30, 2012, 05:55:51 am
Here is (I think) the circuit that forms part of my project:



The value of the resistor (2490 Ohms) is fixed. Vi is a variable voltage (driven by the Arduino PWM output - might be filtered but let's just assume it's a nice, clean DC voltage which will never be greater than 5V). What will Vo be or is it not possible to tell? If it were possible to disconnect the resistor, then I'd do it, but it's inside some other electronics to which I don't have access (a Megasquirt EFI controller).

Also tempted to put a diode in between the Arduino (Vo) output and the node but not sure if this is necessary?
5  Using Arduino / Networking, Protocols, and Devices / Re: using arduino Uno as USB to serial converter on: December 27, 2012, 05:38:38 pm
Sounds like a lot of work but completely understand wanting to do it the hard way!

If you're taking the mouse apart, the "easy" way might be to intercept the signal from the optical sensor(s) before they get converted to USB and pipe those direct to the Arduino... interesting proposition either way - looking forward to hearing about your progress!
6  Using Arduino / LEDs and Multiplexing / Re: Colour changing LED? on: December 23, 2012, 03:58:23 am
Astonishing really (and that's from someone writing this on an iPhone)
7  Using Arduino / LEDs and Multiplexing / Re: Colour changing LED? on: December 22, 2012, 04:16:01 pm
Never mind, just found it here:

http://www.kitronik.co.uk/products/components/leds/leds/colour-changing-and-rgb-leds/5v-colour-changing-led-5mm

Wonder how they work, though?
8  Using Arduino / LEDs and Multiplexing / Colour changing LED? on: December 22, 2012, 04:14:19 pm
We've got a Christmas tree ornament that has a changing pattern of lights inside. I took it apart to find that there is a single LED connected to the battery with a switch. That's it - must be some circuitry built in to the LED but it's clear and just look like a normal one - where can these be bought?
9  Using Arduino / Project Guidance / Re: What sensor do I need to measure a change in physical weight in ounces? on: December 18, 2012, 02:32:48 am
Could you just rig the perch to a spring loaded microswitch instead of weighing the bird (unless you are logging the actual weight of the bird)?
10  Using Arduino / Programming Questions / Re: Random() gives out-of-bounds results on: December 17, 2012, 04:52:24 pm
I can confirm that now it's running properly with no more strange characters

Have yet to feed it live thermistor data but no reason it shouldn't work fine

11  Using Arduino / Project Guidance / Re: 5 volt to 9 volts on: December 16, 2012, 04:22:30 pm
Why can't it just run off the 9 volt battery, then?
12  Using Arduino / Programming Questions / [Solved] Random() gives out-of-bounds results on: December 16, 2012, 12:44:37 pm
I suspect that the 82 is the value 8 only partially overwriting a previous value of 12 or 22 or 32.

Add a print of a space after each print of a value and see whether that still happens.

Genius! I've added an lcd.clear(); to the loop and so far it seems to be working fine... Thank you! smiley-grin
13  Using Arduino / Programming Questions / Random() gives out-of-bounds results on: December 16, 2012, 12:35:36 pm
My code currently calculates 4 random numbers, from 0-32 by calling "random(33)". It then displays these and the average on an LCD display.

However, I keep getting numbers higher than 32, which sometimes affects the average and sometimes doesn't)

Code:
/*
  LiquidCrystal Library - Custom Characters
 
 Demonstrates how to add custom characters on an LCD  display. 
 The LiquidCrystal library works with all LCD displays that are
 compatible with the  Hitachi HD44780 driver. There are many of
 them out there, and you can usually tell them by the 16-pin interface.
 
 This sketch prints "I <heart> Arduino!" and a little dancing man
 to the LCD.
 
 The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * 10K potentiometer:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 * 10K poterntiometer on pin A0
 
 created21 Mar 2011
 by Tom Igoe
 Based on Adafruit's example at
 https://github.com/adafruit/SPI_VFD/blob/master/examples/createChar/createChar.pde
 
 This example code is in the public domain.
 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 
 Also useful:
 http://icontexto.com/charactercreator/
 
 */

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

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// make some custom characters:
byte bar0[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b11111
};

byte bar1[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b11111,
  0b11111
};

byte bar2[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b11111,
  0b11111,
  0b11111
};

byte bar3[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b11111,
  0b11111,
  0b11111,
  0b11111
};

byte bar4[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b11111,
  0b11111,
  0b11111,
  0b11111,
  0b11111
};

byte bar5[8] = {
  0b00000,
  0b00000,
  0b11111,
  0b11111,
  0b11111,
  0b11111,
  0b11111,
  0b11111
};

byte bar6[8] = {
  0b00000,
  0b11111,
  0b11111,
  0b11111,
  0b11111,
  0b11111,
  0b11111,
  0b11111
};
// this will be an array to hold bargraph values. It's currently just holding fixed values)
char display[4][12]={
  {
    254,(byte)0,254,254,(byte)1,254,254,(byte)2,254,254,(byte)3,254  }
  ,
  {
    254,255,254,254,255,254,254,255,254,254,255,254  }
  ,
  {
    49,255,254,50,255,254,51,255,254,52,255,254  }
  ,
  {
    254,255,254,254,255,254,254,255,254,254,255,254  }
  ,
};

 unsigned long previousMillis = 0;
 int cyl1,cyl2,cyl3,cyl4;

void setup() {
  randomSeed(analogRead(A0));
  // create new characters
  lcd.createChar(0, bar0);
  lcd.createChar(1, bar1);
  lcd.createChar(2, bar2);
  lcd.createChar(3, bar3);
  lcd.createChar(4, bar4);
  lcd.createChar(5, bar5);
  lcd.createChar(6, bar6);


  // set up the lcd's number of columns and rows:
  lcd.begin(20, 4);
  // Print a message to the lcd.

  //  lcd.print(" Arduino! ");



}

void loop() {


  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > 5000) { // refresh the display every 5 seconds
    // save the last time you blinked the LED
    previousMillis = currentMillis; 
    // get some random cylinder readings
    cyl1=random(33);
    cyl2=random(33);
    cyl3=random(33);
    cyl4=random(33);
   
    int average=(cyl1+cyl2+cyl3+cyl4)/4;

    lcd.setCursor(0, 0);
    lcd.print("1:");
    lcd.print(cyl1);
    lcd.setCursor(0, 1);
    lcd.print("2:");
    lcd.print(cyl2);   
    lcd.setCursor(0, 2);
    lcd.print("3:");
    lcd.print(cyl3);   
    lcd.setCursor(0, 3);
    lcd.print("4:");
    lcd.print(cyl4);


    for(int j=0;j<4;j++){
      lcd.setCursor(5, j);

      for(int i=0;i<12;i++){
        lcd.write(display[j][i]);
      }
    }
lcd.setCursor(17,1); // second row down
lcd.print("Ave");
lcd.setCursor(18,2); // third row down
lcd.print(average);

  }

}


Here's a sample output:



14  Using Arduino / Programming Questions / Re: [Solved] #include files on: December 13, 2012, 05:59:02 pm
You are better off sticking to the .h or .cpp paradigm (who includes .txt files into C source?) and work with the IDE on this one.

Actually, I only put a .txt file for this forum - I was trying to include a .ino file but you say they are concatenated together (in alphabetical or tab order?). I'll stick to the .h for the headers and rejig my code to use the tabbed bits
15  Using Arduino / Programming Questions / Re: #include files on: December 13, 2012, 01:54:09 pm
after adding "#define byte uint8_t" to the top of the file (because I was getting a "byte does not name a type" error)

I suggest replacing that with...

Code:
#include <inttypes.h>


If you say so! smiley-grin
Pages: [1] 2