Show Posts
Pages: [1] 2 3 ... 280
1  Using Arduino / General Electronics / Re: Using a transistor instead of a relay as a button on: Today at 09:33:44 pm
It should work, I would wire it like below. In the pinMode() call, turn the pullup resistor on for the input pin (INPUT_PULLUP). This circuit will invert the logic: When 12V is applied to the transistor, the MCU pin will be pulled LOW. When no voltage is applied, the MCU pin will read HIGH. The transistor can be any general-purpose small-signal NPN type, e.g. 2N3904, 2N2222, 2N4401, etc.
2  Using Arduino / Sensors / Re: resistor on: Today at 09:23:16 pm
what does the above means . i thought resistor reduces the current.

The application of a resistor as described would probably not affect anything if the microcontroller were being connected to another high-impedance device, e.g. CMOS. Because the impedance is very high, so little current flows that the resistor would not cause a significant voltage drop, but would protect the microcontroller by limiting current in the event of a short or other wiring error.
3  Using Arduino / Sensors / Re: resistor on: Today at 09:12:59 pm
It would look something like this.
4  Using Arduino / Sensors / Re: resistor on: Today at 09:07:00 pm
A 5V relay should not be connected directly. The current drawn from a pin should be limited to 20mA. Check the datasheet for the relay, it almost certainly needs more current than that. Use a transistor driver with a flyback diode across the relay coil.
5  Using Arduino / General Electronics / Re: Connecting potentiometer to breadboard? on: Today at 09:04:24 pm
I have a soldering iron and solder at home.
But I don't know if it's a good idea to use it. What if I want to use this for something other that a breadboard?
I guess I would have to desolder...?

Sure, not a problem. Coincidentally, I did the same thing today. Desoldered some old wires from a pot, cleaned up the terminals with desoldering braid, soldered new wires on so they'd plug into a breadboard. I used 22 gauge solid wire which works well with breadboards but too much flexing or moving of the pot could eventually cause a break, so I secured the pot with some double-sided tape. It's just for a demo I'm doing, so not a long-term situation.
6  Using Arduino / Programming Questions / Re: How to share code? on: Today at 01:22:47 pm
Yeah, I'm sure some documentation would be a good thing. Two days ago it was just my private stash so its pretty terse.

-jim lee

Looks like some good stuff, though.
7  Using Arduino / Project Guidance / switch versus if on: Today at 01:22:09 pm
Are "switch" statements faster to process than "if / else" statements?

I haven't looked at the assembly code, but I'd be surprised if there were significant differences. It's probably six and a half of one and a dozen of the other  smiley-wink
8  Using Arduino / Programming Questions / Re: How to share code? on: Today at 07:04:22 am
A ReadMe file can be a good thing, they look better if written in Markdown, so that is worth learning as well. FWIW, here is a recent library I posted.
9  Using Arduino / Programming Questions / Re: Multitasking on: July 27, 2014, 07:33:34 pm
Just saw the Adafruit link, that gives some clues to the sensor. Both the transmit and receive code depend on delays, i.e. either delay() or delayMicroseconds().

While these delay functions are doing their thing, the microcontroller can do nothing else. I'm not familiar with the Scheduler library, but on top of this code, it can't possibly help. And while the pulseIR() function is running, with interrupts inhibited, nothing else will happen, for a couple milliseconds in some cases.

Are you aware of the famous BlinkWithoutDelay example? Basically all calls to delay() and delayMicroseconds() need to be removed and replaced with the timing technique used in BlinkWithoutDelay. Then, while one section of the code is waiting on one thing, another section of the code can still be doing useful work.

I also believe there are some IR libraries out there but I am unfamiliar with them. I don't know whether they'd be any help. This project may be a bit of a challenge since the timings are relatively fast. I might consider using one of the AVR's hardware timers to generate the output pulses, this would relieve the code of that processing and then it would just have to turn the timer on and off at the proper times.

I'd still like a better overview. Describe the whole system, the inputs, the outputs, and how they relate. Certainly receiving the IR codes is not enough, they will need decoding and then something will be done based on what is received.
10  Using Arduino / Programming Questions / Re: Multitasking on: July 27, 2014, 07:09:52 pm
How does the sensor work? When is it "done"?
11  Using Arduino / Programming Questions / Re: Multitasking on: July 27, 2014, 06:55:22 pm
Your explanation is weak. What should the program accomplish? What are these "some problems" you're having?
12  Using Arduino / Programming Questions / Re: State machines on: July 27, 2014, 06:42:56 pm
I think this topic definitely needs more attention than it gets. I'm currently creating my final project for school with a group of two other people, which involved synchronizing two radio modules so they could transmit at defined intervals and sleep in between to conserve battery power. Not the most difficult thing in the world to code, but not trivial either.

Before programming, we decided to create a state diagram to cover the different modes of operation and the events we wanted to use to transition between them. After a few hours banging out two state diagrams in Visio, the main code almost wrote itself. After several hours of programming following the basic switch-case style, and some minor bugs unrelated to the state logic (silly things like not giving the radio enough time to wake up after sleep), the two devices worked near perfectly on the first try. There's still one small bug that needs to be investigated, but that's still a huge achievement.

Consider me a convert. State diagrams rock.

Congratulations on a successful project. I've used the same words, "once the diagram is complete, the code almost writes itself." Points out the importance of putting the effort into the diagram, and resisting the urge to start coding prematurely.
13  Using Arduino / Programming Questions / Re: How to share code? on: July 27, 2014, 06:28:09 pm
I am starting to play around with gitHub. I wanted something to use to share code from home & work computers. I'm so new to it though.. How does one sure something on there?

-jim lee

I use Git (on the PC) and GitHub and like them pretty well. It was a new concept to me, or rather the first VCS I'd used. Code lives in repositories, which can contain many files, subdirectories, etc. Repositories (repos) can be on GitHub or on your machine. (There's no obligation to use GitHub at all, but of course a repo on your PC won't get shared.)

Get a logon ID on GitHub, download the software. There's good step-by-steps on the site. Basically, repos are created on your local machine and on the GitHub web site. When you're ready to share, "push" a repo (actually, a branch or branches of the repo) from your machine to GitHub.

There's a book you can read called Pro Git, and there's a PDF version on the web site that can be downloaded free.
14  Using Arduino / Programming Questions / Re: How to share code? on: July 27, 2014, 06:12:58 pm
Those sound interesting, so let us know when you find a repository you like! Personally I dislike Facebook and I don't consider video (e.g. YouTube) a good medium for the purpose.
15  Community / Exhibition / Gallery / Re: Lucid dreaming glasses - first project on: July 27, 2014, 05:19:59 pm
This is meant to simulate hypnagogic imagery (the shapes and colors you see as you're falling asleep).

Haven't ever seen these, is something wrong with me?

But I have seen warnings on LED datasheets and other publications from LED manufacturers to not look directly into them, especially blue, violet and white (which are really blue or violet with a phosphor) types.
Pages: [1] 2 3 ... 280