Show Posts
Pages: [1] 2
1  Using Arduino / Networking, Protocols, and Devices / Re: Arduino U-blox M6 Gps not working on: April 09, 2014, 04:09:38 pm
I have the exact same setup and problem. The GPS board has a blinking green led indicating that it is powered correctly but no data is being returned. I have let it run for far longer than it should have taken to acquire data and still nothing but the ********.
2  Using Arduino / Project Guidance / IR Remotes & Unique codes on: August 31, 2012, 03:39:15 pm
I am thinking about a project that would be an Arduino controlled by an IR remote.  There could be several of these all in the same general area so I need a way of making sure that each remote is uniquely "paired" to it's own Arduino and can't end up accidentally controlling another Arduino.

I have done a lot of searching on this, and have even built the general circuit using an IR remote from Adafruit but I haven't found any info on how to ensure the unique pairing.

I know that remotes for car alarms are programmed so that they are uniquely paired but are there IR remotes that can do this? 

Would an RF remote be any different?

Or is there a way to handle it within the Arduino code somehow?

My thought is that it is probably not possible but as I am still a relative Arduino newbie I thought I would ask.

Thanks,
Jay
3  Using Arduino / LEDs and Multiplexing / Re: TPIC6B595 Troubles on: February 10, 2012, 05:22:12 am
I knew that this project should be that hard...

I ordered 3 TPIC6B595 shift registers from a local electronics house.  It turns out that I was shipped 3 74HCT299N shift registers which are of course completely different.  So I have to deal with them to get the right product now before I can continue on this project.

I know I should have looked but I trusted that they would be able to ship the product that was ordered when there are such small differences in parts...lesson learned.

Thank you all very much for your time, hopefully once I have the right part I will be able to just plug it in and everything will be working as desired thanks to your help.

4  Using Arduino / LEDs and Multiplexing / Re: TPIC6B595 Troubles on: February 09, 2012, 03:23:35 am
Sorry for the confusion there.  I've only spread things out on the diagram to make it easier to see.  I have everything contained on my actual breadboard between 0 and 30.  I'm still learning to use Fritzing so making things further apart makes it easier to make sure everything is hooked up the way it should be.

Thanks for the idea though.
5  Using Arduino / LEDs and Multiplexing / Re: TPIC6B595 Troubles on: February 08, 2012, 05:47:17 pm
I currently have this:



I am using this code:
Code:
#include <SPI.h>

void setup() {
  pinMode(SS, OUTPUT);
  SPI.begin();// library takes care of D11,12,13
}

void loop(){
  // say 3 devices being used
  digitalWrite (SS,LOW);  // SS (D10)goes to SRCK PIN on all devices
  SPI.transfer(0);  // SCK (D13) goes to clock pin on all devices
  //SPI.transfer(255);  // MOSI (D11) goes to serial data pin on device 1,
  //SPI.transfer(byte3);  // SEROUT from device 1 goes to device 2, etc
  digitalWrite (SS,HIGH);  // outputs update on this rising edge
   
  // check if byte1,2,3,4 need update
  // etc.
}

No matter what value I put in the SPI.transfer() it still only lights up the last LED and it is also lighting up the LED on pin13 on the Arduino Uno itself.

It's late and I'm sure I'm just missing something simple, hoping anyway.

Thanks.
6  Using Arduino / LEDs and Multiplexing / Re: TPIC6B595 Troubles on: February 08, 2012, 05:10:56 pm
I've received the caps but I'm not quite sure where to place them in my current layout.  I'm thinking that I may need to change the power/ground layouts on the board for them to work correctly?

Is anything else incorrect?



Thanks.
7  Using Arduino / LEDs and Multiplexing / Re: TPIC6B595 Troubles on: February 07, 2012, 07:38:22 am
Thanks, ordered some, should be here in a day or two and I'll post back with my results, or lack thereof.
8  Using Arduino / LEDs and Multiplexing / Re: TPIC6B595 Troubles on: February 06, 2012, 11:39:02 am
Will these work?  I'm trying to get stuff locally as shipping and customs taxes are ridiculous in Sweden.

Capacitor 100nF 50V Y5V axiell
Multilayer ceramic capacitor.
Tolerance 20% on
The body size 2.5 x 4.3 mm.
Suitable hole interval 5 mm.
Bendiameter 0.5 mm.

http://www.electrokit.com/en/capacitor-100nf-50v-y5v-axiell.45633

Thanks.
9  Using Arduino / LEDs and Multiplexing / Re: TPIC6B595 Troubles on: February 01, 2012, 05:46:01 pm
Thanks for the reply, glad I'm at least starting to get this...

You said "Connect OE/ to Gnd, or drive it low with an arduino pin", I don't see an OE on the datasheet.  Forgive me if it is a standard term, my background is in programming.

I don't have any 100nF/0.1uF caps right now, is it critical for this to work or is it more for balancing?

Thanks.
10  Using Arduino / LEDs and Multiplexing / Re: TPIC6B595 Troubles on: February 01, 2012, 05:02:53 pm
CrossRoads, looking at your short example and the Arduino SPI documentation it seems that SPI is the better way to go for what I want to achieve eventually.  I have a couple of questions though. 

First you state that D9 is the SPI pin but the Arduino SPI documentation states that "SPI bus uses pins 10 (SS), 11 (MOSI), 12 (MISO), and 13 (SCK)".

Next you stated "SCK (D13) goes to clock pin on all devices", the TPIC6B595 has no SCK, did you mean RCK?  I guess they're probably technically the same across the different chips but since TI labeled it as RCK, I want to make sure I'm not doing something incorrect.

Using the diagram in the first post, I changed the Arduino Uno connections so that D10 goes to SRCK, D11 goes to SER_IN and D13 is going to RCK.  I have Vcc tied to 5v and the three GNDs tied to ground.  Nothing is connected to SRCLR.

Here is my current code:
Code:
#include <SPI.h>

void setup() {
  pinMode(SS, OUTPUT);
  SPI.begin();// library takes care of D11,12,13
}

void loop(){
  // say 3 devices being used
  digitalWrite (SS,LOW);  // SS (D10)goes to SRCK PIN on all devices
  //SPI.transfer(byte1);  // SCK (D13) goes to clock pin on all devices
  //SPI.transfer(byte2);  // MOSI (D11) goes to serial data pin on device 1,
  //SPI.transfer(byte3);  // SEROUT from device 1 goes to device 2, etc
  digitalWrite (SS,HIGH);  // outputs update on this rising edge
   
  // check if byte1,2,3,4 need update
  // etc.

}

When I upload this the behavior is that the right most LED is constantly on.  I wouldn't expect this as I'm not currently sending anything out via SPI.transfer.  If I change the commented SPI.transfer(byte1) to send a value of 0-255 the rightmost LED is still constantly on and nothing different happens.

Thanks.
11  Using Arduino / LEDs and Multiplexing / Re: TPIC6B595 Troubles on: February 01, 2012, 07:15:11 am
Isn't this the point where Grumpy Mike comes in to mention that you aren't using any decoupling capacitors on the supply pins smiley

Martyn.

I'm honestly not sure what those are, I'm still rather new to the hardware side, my background is in programming.  This is the only tutorial that I've seen using the TPIC6B595 that seemed to be complete.  If there is anything wrong in it then it might explain why it isn't working.

I noticed you left the output enable pin (/G, pin 9) disconnected.  Try connecting this to ground.  (It may not solve your issue, but it's good practice not to leave unconnected input pins).

I just tried connecting this and it made no difference at all.

I'm completely open to dumping all of this setup just to get something working.  I have a project that requires the use of 3 chained shift registers but until I get a demo of one working there is no point in continuing on my main project. 

So if someone can either point me to something that they know works or better yet post a working block of code and wiring schematic I'd be very grateful.

Thanks.
12  Using Arduino / LEDs and Multiplexing / Re: TPIC6B595 Troubles on: January 31, 2012, 05:33:02 pm
I actually only made the modifications in trying to start debugging it.  So I have re-downloaded the code and am using it "as is".

I re-wired everything on another breadboard, double checked the diagram several times and even used another chip (I have 3 that I am planning on eventually chaining together).

I am still getting the same exact behavior. 

As I mentioned before I am powering my Uno via USB, could that be the issue?  I didn't think so because only one LED was being powered at a time.  When I press the reset button all the LEDs light up but I assume that is simply because the chip isn't pulling them low during that time.  I assume by that that the power should be sufficient.

Just to confirm that it is something on my end, did you test this or are you just using experience/knowledge to confirm that it *should* work?  I don't mean that as an insult but I can't see anything that I'm doing differently and it's still not behaving as it should.

This is the first time I've worked with a shift register but from everything I've read it shouldn't be this difficult.

Thanks.
13  Using Arduino / LEDs and Multiplexing / TPIC6B595 Troubles on: January 31, 2012, 10:38:29 am
I'm having some difficulty working with a TPIC6B595 shift register.  I am using this tutorial which supplied the following code and wiring diagram:

http://flashgamer.com/arduino/comments/arduino-controlling-24-leds-with-shift-registers

Code:
/*
 Shift Register Example
 for TPIC6B595 shift register by Jens C Brynildsen

 This sketch turns reads serial input and uses it to set the pins
 of a TPIC6B595 shift register.

 Hardware:
 * TPIC6B595 shift register attached to pins 7, 8, 11 and 12 of the Arduino,
 as detailed below.
 * LEDs attached to each of the outputs of the shift register

 Based on the example created 23 Mar 2010 by Tom Igoe

 */

//Pin to clear the register
const int clearPin = 7;
//Pin connected to latch pin (RCK) of TPIC6B595
const int latchPin = 8;
//Pin connected to clock pin (SRCK) of TPIC6B595
const int clockPin = 12;
////Pin connected to Data in (SER IN) of TPIC6B595
const int dataPin = 11;

int counter = 0;
int numLedsInUse = 8;

void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(clearPin, OUTPUT);
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  Serial.begin(9600);
  Serial.println("*");
  
  // Always start by setting SRCLR high
  digitalWrite( clearPin, HIGH);

  // delay a little and then set
  delay(100);
}

void loop() {
  // Display LED's running
  if( counter >= (numLedsInUse-1) ){
    counter = 0;
  } else {
    counter++;
  }
  
  // write to the shift register with the correct bit set high:
  registerWrite(counter, HIGH);
  delay( 100 );
}

// This method sends bits to the shift register:

void registerWrite(int whichPin, int whichState) {
  Serial.println(whichPin);
    
  // the bits you want to send
  byte bitsToSend = 0;
  // write number as bits
  bitWrite(bitsToSend, whichPin, whichState);

  // turn off the output so the pins don't light up
  // while you're shifting bits:
  digitalWrite(latchPin, LOW);
  Serial.println(bitsToSend);
  Serial.println("_");
  
  // shift the bits out
  shiftOut(dataPin, clockPin, MSBFIRST, bitsToSend);

  // turn on the output so the LEDs can light up:
  digitalWrite(latchPin, HIGH);
}




I am currently powering the Arduino via USB.

The behavior is that the rightmost LED will randomly turn on for a second or two and then when it does the other LEDs starting at the other end might blink very quickly going from left to right.  Then it will be many seconds before it does it again but the timing is totally random and seems to be longer and longer between blinks.

From the video on the tutorial page it should be cycling through the LEDs on a much more regular pace starting at one end, blinking through to the other end and then immediately repeating without much pause.

Thanks.
14  Using Arduino / Programming Questions / Re: Interrupt still happening after detach? on: December 14, 2011, 09:03:33 am
Ok, combining the blink without delay example with the IR remote code I came up with this that performs the desired behavior.  I press the button to start the blinking and pressing it again stops it.  

Code:
/* Blink without Delay
 
 Turns on and off a light emitting diode(LED) connected to a digital  
 pin, without using the delay() function.  This means that other code
 can run at the same time without being interrupted by the LED code.
 
 created 2005
 by David A. Mellis
 modified 8 Feb 2010
 by Paul Stoffregen
 
 This example code is in the public domain.

 
 http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
 */

#include <IRremote.h> // use the library for IR

// constants won't change. Used here to
// set pin numbers:
const int irRemotePin = 2;      // pin 1 of IR receiver to Arduino digital pin 2
const int ledPin =  5;      // the number of the LED pin

IRrecv irrecv(irRemotePin);      // create instance of 'irrecv'
decode_results results;

// Variables will change:
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated

int ledButtonState = LOW;

// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long interval = 600;           // interval at which to blink (milliseconds)

void setup() {
  Serial.begin (9600);
  irrecv.enableIRIn(); // Start the receiver
  // set the digital pin as output:
  pinMode(ledPin, OUTPUT);      
}

void loop()
{
  irReceive();
  
  // here is where you'd put code that needs to be running all the time.
  ledBlink();
}

void irReceive()
{
  if (irrecv.decode(&results)) // have we received an IR signal?
  {
    translateIR();
    for (int z=0; z<2; z++) // ignore 2nd and 3rd signal repeat
    {
      irrecv.resume(); // receive the next value
    }
  }
}

void translateIR() // takes action based on IR code received
{
  long results_value = results.value;
  switch(results_value)
  {
    case 0xFFC23D:  
      Serial.println("LED Flash Button Pressed");
      if (ledButtonState == LOW)
        ledButtonState = HIGH;
      else
      {
        ledButtonState = LOW;
      }
      // force the pin low to forcibly shut off the LED
      digitalWrite(ledPin, LOW);
      Serial.println(ledButtonState);
      break;
  }
}

void ledBlink()
{
  // check to see if it's time to blink the LED; that is, if the
  // difference between the current time and last time you blinked
  // the LED is bigger than the interval at which you want to
  // blink the LED.
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > interval && ledButtonState == HIGH) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;  

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(ledPin, ledState);
  }
}

Please feel free to comment on anything it in that could be done better.

I moved the core of the blinking action into the ledBlink() function because I want to expand it to include more LEDs blinking in patterns eventually.  Currently I still have to call the ledBlink() function from within the main void loop() for it to function.  However, I'm thinking that by having it in the main loop the processor has to go to it all the time even though the button might not have been pressed yet which is a waste of time/cycles.  Or is this not a real concern?

I would like to do something where the function is called by the actual button press and runs in a loop but is still able to detect other button presses that might be doing similar actions like moving a servo for example.  Is the code above the proper way to do this?

Thanks,
Jay
15  Using Arduino / Programming Questions / Re: Interrupt still happening after detach? on: December 14, 2011, 08:16:23 am
I guess I don't really understand how/where to place the attachInterrupt then.  It only needs to be active while the LED function is running so that I can stop the function whenever I want.  Eventually I want to make the LED function into a loop so that on the first button press the LED will start "blinking" and then on the second press it will stop.

The serial print is only there for debugging purposes so that I could see if anything was happening after the second button press.

Thanks,
Jay
Pages: [1] 2