Show Posts
Pages: 1 ... 48 49 [50] 51 52 ... 82
736  Using Arduino / LEDs and Multiplexing / Re: TPIC6B595 Troubles on: February 01, 2012, 12:39:30 pm
Please use the "#" button when posting code.

<runs for cover> smiley smiley-wink
737  Using Arduino / LEDs and Multiplexing / Re: TPIC6B595 Troubles on: January 31, 2012, 03:41:26 pm
Spent some time looking at this ... one difference to the original you link to is that he first raises the "clearpin" after the delay, you do it before. So the clearpin is low (after being set to OUTPUT it starts at LOW - meaning "active", negative logic) for only a very brief interval before you set it HIGH (meaning "inactive"). It should be long enough all the same.

You have put a bit of Serial IO in the registerWrite routine and that takes a long time (relativly speaking) but - again - it should not matter.

So the conclusion is you have not wired things correctly as the most likely culprit. Or blown the chip by a previous incorrect wiring (not as likely)
738  Using Arduino / Motors, Mechanics, and Power / Re: Arduino UNO R3 and Motor Shield R3 on: January 31, 2012, 02:58:43 pm
(Note - I have not reveiwed your last submission yet, so this reply is to your original post)

Well, if you say the decoding works without the motor ... and what you have here is the same IR receive code, then we've likely got a hardware problem.

OR

you may exceed RAM space (the 2K limit). This is easily checked, include and print the value from the "memoryfree" library.

Otherwise there are bits of your code that ... ehr .. surprise me.
Code:
      myValue = results.value;
      long r1c1 = 16738455;
      long r1c2 = 16754775;
      long r1c3 = 16722135;
      long r2c1 = 16740495;
 :
         
  Serial.println(myValue);
     if (myValue == r1c1)
  { 
    Serial.println(" r1 c1");
    analogWrite(10, 1);
  }
    if (myValue == r1c2)
  { 
    Serial.println(" r1 c2");
      analogWrite(9, 0);
You probably do not get what you expect? Writing "16738455" is treated as an int and may be truncated to 16 bits, ie 26775. But you say it has worked? Anyhow, but a suffix of "L" behind the constant and it is a long value.

Replace this one-shot use of variables (eating a little each of that 2K) in your "if"s directly
Code:
if ( myValue == 16738455L )
   {  whatever ; }
Actually and better, you should use the case-switch statment. It does support long, as long as you rember the trailing L. OK I was not 100% sure, so I wrote a tiny test
Code:
void setup() {Serial.begin(9600) ;}
long lv = 333333L ;
void loop() {
  delay(1234) ;
  switch(lv) {
    case 123456L: Serial.println("123456") ; break ;
    case 234567L: Serial.println("234567") ; break ;
    default: Serial.println("Eh?") ;
  }
  if ( lv== 123456L ) lv = 234567 ; else lv = 123456L ;
}

Each of the strings in println will also eat of the 2K RAM - try to (temporarily) comment the println() out.
739  Using Arduino / Motors, Mechanics, and Power / Re: Arduino UNO R3 and Motor Shield R3 on: January 31, 2012, 02:56:34 pm
you MUST use the "#" button (in the toolbar above the text entry field) when submitting code. Its not just to look pretty, it ensures that if you write
Code:
[i]
I can see that you have "i" as a subscript to an array. Without the code field it just means - from here start italicizing the text in the browser.

Note that you can now edit your own posts. (Normally discouraged, but usefull to remove an embarrasing typo - or a forgotten code-tag ) Hit the edit/pen button, then highlight the code section, then hit the code button. Or include manually the code-begin and end tags
740  Community / Website and Forum / Re: No documentation on ternary operators ? : on language ref page. et al on: January 30, 2012, 10:36:46 am
The problem with having an "advanced user" section to the docs (and this is pure conjecture on my part) is that you would have beginner users trying to use and do things that they have no understanding of, or even have the base concepts down to form the understanding. They might even try to use and do things with the idea that it is what their project needs because it is "more advanced" or because they have an incomplete (or wrong) understanding of what the advanced concepts allow them to do.
Indeed ! (my highlight) It matches with my experience with the in-experienced (also with so called professionals who turn up at the "advanced course", without haven taken the pre-requisite "basic" ...)
741  Community / Website and Forum / Re: No documentation on ternary operators ? : on language ref page. et al on: January 29, 2012, 01:06:45 pm
"Conditional Operator"  "? : (ternary operator)"
Yes, well, it is my favorite, too.

Also missing is structs. Pointers are not explained either, except saying "its too complicated". "asm" is missing; for tight programming (when speed/space is essential).

And just about everything for the c++ part, which th compiler fully supports. Like classes, and all the object-stuff. Of course, with only 2K RAM you do not want the overhead of too much object-oriented stuff.

BUT

The Arduino enviroment is designed for/targeted to beginners. The fact that some advanced users can use it too is just a benefit. If the Arduino had used some "lego"-like language with very few language contructs and a "BASIC" like syntax, then there would be no advanced users.

All in all, I have to acknowledge that they have made quite a good choice: Real C/c++ so users can get advanced but only expose/document a reasonable subset.

The doc on 'variables' should mention what VALUE is set for "HIGH" and "LOW" and that it requires an INT type,
not boolean, which is what one would assume for a two state "type"
Yes, well, there are a number of inconsequential documentation and a few mistakes, too. Only the siteowners have write access, and in this forum there are a number of "bug reports" on documentation and tutorials ... and nothing has been corrected/enhanced. Even those blessed(?) with GlobalModerator access can not change it, and they have volunteered.

Well, it is for free, so some minor flaws to be accepted. And it enhances the experience smiley smiley

742  Community / Website and Forum / Re: No documentation on ternary operators ? : on language ref page. et al on: January 29, 2012, 12:45:14 pm
Code:
#ifndef Binary_h
#define Binary_h

#define B0 0
#define B00 0
#define B000 0
#define B0000 0
#define B00000 0
#define B000000 0
#define B0000000 0
#define B00000000 0
#define B1 1
#define B01 1
#define B001 1
#define B0001 1
#define B00001 1
#define B000001 1
#define B0000001 1
#define B00000001 1
and so on for about 500 more.
743  International / Scandinavia / Re: Styra ett Arduino från ett annat? on: January 28, 2012, 06:41:36 am
Det funkar. Elektrisk mycket enkelt. Kryssa TX och RX linjerne mellam dom två. Jeg har använt det i et projekt.

Meeeen du skal bestämma protokollen (vilket tecken betyder vad, hur lång en kommando är (sluttecken) och något felhandtering(checksumtecken)). Det kan vare enkelt eller kompliceret, det beror på hur kritisk det är.

Om du vil ha både USB kommunikation och Seriel kommunikation mellam dom, så skal du jo använda NewSoftSerial eller en Mega så du har nog komm linjer.
744  Using Arduino / LEDs and Multiplexing / Re: Control a 36W LED strip. on: January 27, 2012, 11:11:45 am
I'm gonna recap what I understood just to make sure I won't hurt my Arduino smiley-wink

- A MOSFET is kinda like a transistor but controlled by the voltage on the gate and not the current.
- The characteristics of a MOSFET are: the voltage needed on the gate to turn it fully on and the current supported by the source-drain.
You're doing fine.

- A logic level MOSFET (what does that mean ?)
- A MOFSET that is fully on with 5V and the current produced by the Arduino (30mA ?)
The "logic" means that 5V is enough for MOSFET fully on, other non-logic-MOSFETs usually require 8-10V. But otherwise it works the same - both types could be used in a real analog circuit.
- A MOFSET that supports at least 12V and the current that my LEDs are gonna need.
Yes, but for saftey margings choose a MOSFET for at least double that. Unless you go for a tiny surfacemount one, they will usually far exceed your minimum specs, and that is OK.

- For connecting it to my Arduino, I just connect the output pin directly to the gate, the +12 to the LEDS and the other cable of the LEDS to the source and then the GND to the drain.
Yes. Spot on.

- It's not needed to put a resistor between the Arduino and the gate because it's voltage controlled not current right ?
Yes, no and maybe. It is not really needed, but some MOSFETs the gate capacitance is such that for a short moment the current is large. Putting a resistor (1K Ohm) there limits the current, but it turn on slower (we ar talking few millionths of seconds here, nothing you'd notice) For this application, put it in.
- A resistor between the gate and the GND will make the LEDs on when my Arduino is off.
Sorry, totally wrong. It will make sure the MOSFET is fully OFF (and your LEDs, too) when the Arduino pin is in high impedeance mode or your LED circuits gets disconnected from the Arduino. If it is not there the MOSFET may get a little charge or voltage turning it half on. That means it effectivly will dissipate 6V at 1A and while your LEDs are half lit, the MOSFET will get HOT.

The reason you can have "half" lit LEDs during normal operation is that they are not - they alternate between fully LIT (MOSFET has very low resistance ie no voltage drop to dissipate) and fully OFF (MOSFET has very high resistance, almost no current to make heat) and they alternate so fast your eye only sees the average.

Now go and get that circuit build and the LEDs a'flashing smiley
745  Using Arduino / LEDs and Multiplexing / Re: Control a 36W LED strip. on: January 24, 2012, 06:31:56 am

An N-FET is just a specific variation of a MOSFET, just like a NPN is a varaiation of a transistor (sometimes called a BJT)

Every circuit every signal has both current and voltage. The two are interdependent on each other defined by the resistance. For all "active" components the resistance is "dynamic" and varies with how much voltage/current is applied (as opposed to a resistor). One specifies transistors as "current amplyifying" as that is the easiest way to specify what they amplify (base->emitter current controls the Collect->Emitter current), and on MOSFETs one sepcifies the gate voltage (there is very little current flowing in the gate) but it controls the Drain->Source current.

Just as shown in the webpage for the simple N-Fet example is how you can wire it. A MOSFET(N-FET) will still have some resistance, so at 4A it may become warm (multiply the Rds value from the spec sheet by the current) so in practice you need to cool it, ie mount it on a heat sink. Otherwise the Arduino 5V (and potentientally 30 mA) is enough to turn on/off the specified MOSFET. There is no "surplus" if the MOSFET is rated at 40A, on the contrary, it is always good to have a large margin away from the specified MAXimums.

Picking another MOSFET or transistor requires a few simple calculations. I wont mention them all here, you can find introductory texts somewhere, but for a MOSFET the important thing is that it is a "logic" MOSFET that turns fully on with a gatevoltage below 5V. Most only turn on halfway and are fully on at 10V. The other to watch for is Ids max current and the voltage it can block.
If you choose a transistor you need to make sure that when the Arduino supplies 30mA into the base that the amplyfying effect "hfe" gives you enough current (the 1 or 4 A you need). You must put a resistor between the Arduino and base so you only get 30mA (or less if possible) at 5V otherwise the Arduino may try and supply more and damage its output circuits (they are not protected against overcurrent). Usually one uses a Darlington Transistor Pair so the input current only needs to be a few mA (you have to choose a larger base resistor) to get multiple A.

Read the good intro to basic transistor/MOSFET knowledge you found, again.
746  Using Arduino / LEDs and Multiplexing / Re: LED/ voltage input on: January 23, 2012, 03:38:56 pm
A question like that "i am in a hurry", and with only a very brief overview of the problem - and no code or circuit or anything that shows what you have tried so far ... or indeed if you have even unpacked your Arduino or equivalent ...

It is a school exercise. "We" do not solve school excercises.

Of course I could be wrong. Appolgies in that case, and show what specifically you need help with. (And dont use the "Poll" button)
747  Using Arduino / LEDs and Multiplexing / Re: Control a 36W LED strip. on: January 23, 2012, 03:30:27 pm
I looked at the weblink at it seems (on a first view) a nice RGB amplifier. Unfortunatly I couldn't find the spec sheet so some guesses here may not fit.

It is very easy with a simple transistor or MOSFET circuit to turn the 5V arduino to the 12V for the unit. It implies that you use the Arduino PWM output to regulate the light. Here is a good overview http://www.kpsec.freeuk.com/trancirc.htm

It is also "simple" to just amplify the 5V Arduino with a big enough MOSFET to a many watt output. (ie instead of using the amplifier thing) However, LEDs prefer to be driven by a current controlled source, not a voltage as such. Which leads to the LED strip - they may indeed have some intelligence on the strips, ie control the current as long as 12V is available. 12V will burn any LED that does not have some circuitry with it (a resistor, a full IC) sometimes by putting enough in series they will survive 12V (but you get a huge imbalance between Red and Blue...). In short: what is the LED strip ?

Your project - as presented so far - is simple enough. Find the specification sheet (lots of numbers with voltages, input currents, and such like smiley-wink ) for the amplifier and the LED strip.


(NB: English is my 3rd language, and I daily converse in my 4th. Sorry if it sounds strange. Oh - and I have the occasional typing mistake, too smiley smiley )
748  Using Arduino / Programming Questions / Re: Delay Trouble on: January 22, 2012, 04:55:31 pm
You got two principal errors in this code.

Firstly you reset the timer on EVERY pass through this code. (Re)Setting the timer to millis should be done only when triggered.

Scondly Nick has pointed out you have written
Code:
if (millis()-TimerA >= 2000UL){
  shifter.clear();   // executed if true
  shifter.write();  // executed if true
}
else
  shifter.clear(); // executed if false
shifter.write();  // always executed
Nicks point is that the compiler counts {-brackets and semi colons, not indentention. So you probaly wanted a braces pair after your else

The small fraction of the code you have shown us is an incorrect usage of the "BlinkWthoutDelay" structure. Check it up again, check up the other references and try again. Maybe even post more of your code.
749  Using Arduino / Programming Questions / Re: Delay Trouble on: January 21, 2012, 07:49:44 pm
The example is here http://arduino.cc/forum/index.php/topic,76140.msg574940.html#msg574940 and a longer explanation here http://arduino.cc/playground/Code/AvoidDelay
750  Using Arduino / Interfacing w/ Software on the Computer / Re: Processing.serial <-> Arduino Mega 2560 - fails on: January 21, 2012, 07:45:08 pm
On the processing forum there was a reply (after about one year ?!) which basically sugessted to remove the auto-reset on the Mega.
Quote
pepperbilly33 has responded to Serial with new Arduino Mega 2560 in Forums: Integration and Hardware on 07-Jan-2012 03:28 PM
i had the same problem. after some hours of searching, i finally find the solution:
1. Disable Auto Reset
2. Give some Delay after the port is open

http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection
http://arduino.cc/forum/index.php?topic=50484.0
pb
I have not had time to play with that. Let me know if it works for you.
Pages: 1 ... 48 49 [50] 51 52 ... 82