Show Posts
Pages: 1 ... 13 14 [15] 16 17 18
211  Using Arduino / General Electronics / Re: strategy for automatically switching power source on: June 26, 2011, 10:59:16 am
That helps, thank you floresta.
However...

Question:
My case is slightly different/reverse, which I suppose is easier...

In the diagrams above, the Uno/Duemilanove both are checking for an external source (> 6.6 V) and using that if it exists, else the USB by default.

Whereas in MY CASE, I'd like to use the Li-ion battery (3.7V, regulated to 3.3V) in the DEFAULT situation, BUT if USB exists, then use the USB power instead (via FT232-chip-generated 3.3V source).

Any different/simple solution you would recommend for this case?

Right now, I basically have a physical switch that I manually change depending on when only battery is connected versus when USB is also connected. I just want to automate this simply so that if USB presence is detected, then use it, else continue using battery as default...

[I suppose I could use the above diagram approach with a comparator to compare USB 5V versus Li-ion 3.7 V... That way, If comparator yields high (USB present), the MOSFET connects 5V from USB... Else if comparator yields low (USB absent), then we just use the Li-ion source as the default power-in. Any simpler approach to just detect USB presence and use that?]
212  Using Arduino / General Electronics / strategy for automatically switching power source on: June 25, 2011, 03:10:03 pm
Situation
I made a standalone arduino on a breadboard (with Atmega328 @ 3.3 V, 8 Mhz crystal), and also added an FT232 chip along with a USB connector, so that I can serial-program my breadboard arduino from my PC.
Then, I wanted to make it portable every time I finish programming it, so I added a Li-ion battery, which worked beautifully as well.

Problem
All good with both steps, BUT...
How do I make the Atmega chip switch from one power source to the other automatically?
Meaning, I want the microcontroller to draw power from the battery by default in portable times, but when I plug in a USB cable, I want it to somehow detect that and stop drawing power from the battery and instead take power only from the USB source (via FT232 chip in between).

I've thought of using comparators (because USB and battery voltage are different), or ADC voltage reading, etc... don't know if I'm on the right track. What might be some clean solutions that would work consistently for this task?
213  Using Arduino / General Electronics / Re: Confused by how opamp is supposed to work on: May 09, 2011, 10:28:07 pm
Thank you everyone; learned a lot from the various comments.

The solution for the OP177 opamp did turn out to be using dual-rail supply, +10V and -10V.
Got expected amplification; tested out with a known input from a potentiometer.

By the way, in order to convert, e.g., 5V Arduino provision to +10V and -10V for the opamp's dual-rail...
Here is the chip I used that does this job very well: MAX680
MAX680 is a chip that takes 5V and outputs +10 and -10V.

I've been studying this amp and other opamp theory in more detail, so do let me know if anyone uses this amp and has any problems!
214  Using Arduino / General Electronics / Re: Confused by how opamp is supposed to work on: May 04, 2011, 08:16:21 am
@bubulindo:
but even if that were true (that the opamp won't output at levels close to the voltage driving it), the output I'm getting is FAR different from what I should be getting. A gain of 100 would imply an output of around 1 V; I'm getting near 9.5 V, and even more surprisingly, the output's not changing when I adjust the potentiometer...

and the voltage divider on the input is just the potentiometer I'm using to simulate an input signal (of around 10 mV)... perhaps I didn't draw correctly.
215  Using Arduino / General Electronics / Confused by how opamp is supposed to work on: May 04, 2011, 06:31:44 am
I am having some trouble understanding and getting this opamp to work. My first opamp... Maybe I'm missing a fundamental principle of opamps...?

Situation
Very simple: I have a small signal (mV or maybe tens of mV). I would like to amplify it so that it's larger and so I can read it through an ADC later.

Method
I'm using an Analog Devices OP177 opamp.

Datasheet-recommended application circuit for
"Differential amplifier":


It's very simple according to the data sheet: (http://www.analog.com/static/imported-files/data_sheets/OP177.pdf)
[Application circuit above is from datasheet]

My circuit
For testing, I'm simulating a small input signal by using a potentiometer connected to a DC supply of +10 V. The pot is set to output a voltage of about +10mV (with respect to GND)...

So +10 mV goes to IN+ pin of opamp, and GND goes to IN- pin of opamp.

I supply the opamp with 10V for supply V+ pin, and GND for supply V- pin, even though the app circuit recommends -10 V for supply V-...
Could that have been an issue?

Thus, my final circuit:


Problem
I expect a gain of 100 (b/c I used 1 MOhm and 10KOhm resistors).
So V_output should be 10 mV * 100 = 1 V.
But instead at the output, I'm getting 9.5 Volts (!?!)
i.e., nearly the supply voltage with which I'm powering the opamp.

Note: When I changed the supply voltage, same problem; e.g. if supply voltage is 15 V, I'm getting opamp output of 14.5 V.

Why is the opamp not giving me the expected correct output, even though there's nothing complicated here?
216  Using Arduino / Networking, Protocols, and Devices / Re: Is it possible to get a serial monitor in a command prompt? on: April 21, 2011, 03:54:07 am
i think most, if not all, new windows versions come with Hyperterminal in the menu. quick and easy and solves your problem, IMO.
217  Using Arduino / Networking, Protocols, and Devices / Re: >Working, with library!< Interfacing ADS1213 22-bit ADC on: April 21, 2011, 03:52:08 am
Murdock, I'm curious what kind of noise levels (i.e. precision), or lack thereof, you are getting so far?
Maybe you can post up a summary of numerical results you're getting, as well as a schematic/summary of your overall circuit layout.
218  Using Arduino / Networking, Protocols, and Devices / Re: >Working, with library!< Interfacing ADS1213 22-bit ADC on: April 19, 2011, 10:53:51 pm
@Murdock,
This library is a nice contribution; and glad you got your initial problem solved.
I look forward to checking out one of these chips when, one of these days, I get finished with my other projects!

@Lefty:
Now, after trying bunches of clean voltage sources (regulation, precision reference, etc.) I can't help but think that this basic fact (i.e., my current breadboard layout versus refined PCB) might be the culprit in my own 24-bit endeavors resulting in consistent stability of only about 19 bit-precision.
I'm always a little hesitant about soldering a veroboard circuit (just the complaint of "oh man, things aren't rearrangeable so I've to be sure about my planned layout and if there's major mistakes, I've to desolder a bunch of things and re-solder") but this time, it seems absolutely necessary that I try veroboarding this and shortening wires, etc. to check for any improvement.
219  Using Arduino / General Electronics / Re: Breakout Board for Xbee on: April 18, 2011, 04:49:10 pm
If/when you initially configure your XBee using the computer,
you might also want to get a USB adapter for the Xbee.
one of the choices is sparkfun's "usb explorer", but IMO that one's expensive; I've seen significantly cheaper ones.
220  Using Arduino / General Electronics / Why is the Arduino powered by a 9V, e.g. battery? on: April 18, 2011, 04:43:23 pm
The Atmega328 chip can use 5V, thus it makes sense to use the USB-charging-method, because USB protocol provides 5V power.

So why is it that the Arduino when powered externally, say, by a battery needs a 9V power supply?

Given that one can additionally use a transformer/regulator/etc. combination to in turn change the voltage the device finally gets, HOW does one go about actually choosing what voltage to power your project with?

For example, what voltage battery would you choose in the following two contrasting cases?
Atmega-chip+one-LED (simple) ---versus--- Atmega-chip+Xbee+LCD+buzzer (more power-demanding)
221  Using Arduino / Displays / Re: name: something that converts LCD ribbon to breadboard size on: April 18, 2011, 01:21:44 pm
Thank you Andy. It was an erroneous measurement indeed. It was a 0.5 mm pitch, I verified; so I'm in the process of ordering the Seeedstudio item as well as stock up on a couple of those ebay ones too.

Liked the tutorial on your page; appreciate this reference. And your page on the easing-function idea was gold to discover. Look forward to reading future articles.

One question on the soldering idea in Step2; I'm surprised how fairly convenient this procedure is... Wonder if this method would work for SMD chips/parts in general as well...
How is it that the solder only gets attracted to the pads (and as you said repelled by the board in between) without causing any bridges, generally speaking? I can see how that's clear if the pads were far enough from each other but since the pads are so thinly spaced, why doesn't this just result in connected blobs (as opposited to isolated pads)?
222  Using Arduino / Displays / Re: name: something that converts LCD ribbon to breadboard size on: April 17, 2011, 05:47:42 am
ok. since I just HAD to make sure I knew my search terms were good, I found this:
http://www.seeedstudio.com/depot/lcd-ext-breakout-of-05mm-fpc-p-200.html

if the pitch is correct, that is just about the best deal you're going to find....  Like...  VERY good deal for how flexible it is.

this is so perfect, and not that expensive either. thank you much!
I'm not sure about the exact pitch spec of my LCD's cableout, so I measured using a caliper, and it was around 0.25mm.

How is the design of one of these FPC connectors - do you think the 0.5mm pitch input of the Seeedstudio breakout can accommodate a 0.25mm cable securely despite the extra space?
223  Using Arduino / Displays / name: something that converts LCD ribbon to breadboard size on: April 16, 2011, 02:22:08 am
Hey all, I got an LCD off ebay that has a 50-pin ribbon (?) cable coming out its back that looks sorta like this (not the same but this is just something similar I found on Google images):



So, since there's no breakout/shield included, I want to find some way of connecting/magnfiying these 50 pinouts to breadboard size so that I can hook the LCD up to the Arduino Mega.

I'm wondering how you would go about this... I suppose I need some cable/board that converts from this very-thin-spacing LCD ribbon to a breadboard/IDE/DIP sized connector/cable/pinout.

Does such a thing exist and, if so, what name should I search for?
224  Using Arduino / Networking, Protocols, and Devices / Tutorial: Collecting data via RS-232 output from a device/gauge/instrument on: April 09, 2011, 11:10:41 am
Introduction
This is a useful procedure to use/learn if you have a device (/gauge/instrument), such as a force gauge, a barcode reader, a GPS device, whatever, from which you want to collect data to, e.g., your Arduino.

These notes are based on my knowledge/research over the last few days (and thanks importantly to forum members here who answered my questions!); not everything might be 100% correct but things in this case are pretty simple.

Here is a tutorial on the basic idea of setting things up.
Note 1: In this tutorial, I'll call the external thing the "device", and your microcontroller the "Arduino" (because I tested with the Uno).
Note 2: Some specifics in the setup will vary based on your particular device, as I explain below.
Note 3: This tutorial is written at a beginner comprehension level.

Steps
(1) Ideally, to start, you need to have something that has a female 9-pin output from your device. If necessary (in the case of your device having a standard 25 pin connector), buy a converter cable that gives you what is called a DB9 plug at the end.

(2) The DB9 plug has 9 pins (VERY important: the order of these pins might be different/mirrored based on which way you look at the plug, which cable/DB9 plug you bought, and which device you have... a number of things, so best is to check datasheet... And/Or if you're using a converter cable in between, use a multimeter to find which pins go to which).
Again, TYPICAL (not always) digram (source: http://www.arcelect.com/rs232.htm):


(3) THREE of these pins are important in most cases (in some cases, other pins such as DTR might be important to be used as trigger interrupts).
The pins are: Ground, RX (receive TO device), TX (transmit FROM device)

(4) Now, there is a difference between RS-232 and TTL. The latter, TTL, is the voltage HIGHs and LOWs used in typical digital communication, e.g., in the case of Arduino, and has HIGH near 5 Volts and LOW near 0 Volts. On the other hand, RS-232 is a protocol that uses voltage pulses of a different magnitude (e.g., plus 12 volts might be used for high, and minus 12 volts for low). Also RS-232 has inverted signals with respect to standard digital communication.

(5) So you need to use something in between your device and your Arduino. There is a popular, inexpensive chip that does the protocol conversion for you: a MAX232 chip. (That's Maxim's version; other chip models with 232 at the end are also likely to work).
VERY easy to setup. You need FIVE capacitors of 1 microfarad, and set things up as appropriate; for this, please refer to this diagram from the datasheet of MAX232 (http://datasheets.maxim-ic.com/en/ds/MAX220-MAX249.pdf)


(6) At this point, for example, you can wire up the cables from your device and from your Arduino to the MAX232 chip as follows:
pin 11 of MAX232 -- the TX of your Arduino's serial
pin 12 of MAX232 -- the RX of your Arduino's serial
pin 13 of MAX232 -- the TX of your device's RS-232
pin 14 of MAX232 -- the RX of your device's RS-232
Make sure you also wire up GND of the MAX232 to your Arduino and to your device's RS-232 GND pin.
And of course, wire up 5V output of your Arduino to where it says "5V" on the above circuit diagram.

(7) Note that, by Arduino's serial, I of course mean the RX and TX on pins 0 and 1 (they are also labeled). However, you might want to use these pins for communication with your computer (which is the default setup when you don't wire anything to pins 0 and 1). In that case, you can create Serial communication on any other pins of your Arduino with the help of the popular NewSoftSerial library; very simple to use. Download and read about it here: http://arduiniana.org/libraries/newsoftserial/
My code provided below uses NewSoftSerial library.

[8] Now you're all set. Some devices send (TX) data out continuously by default, some devices take (RX) data, and some devices send data only upon receiving something (TX after RX).
In all cases, your device's manual/datasheet should explain the specifications involved.
Specifications to watch for:
--Baud rate: Change your Serial.begin's baudrate accordingly.
--Start/stop bits: NewSoftSerial library's serial print and read commands automatically take care of these bits, so you're good.
--Commands: If your device only sends data upon receiving something, that means you need to first send it a command character, often an ASCII character, and often followed by a carriage return.
Again, when you do a print command with NewSoftSerial, you'll be set, but for carriage return, you do need to use ".print(13,BYTE)"... here, 13 corresponds to an ASCII carriage return.

Code
Here is my present code (remember to change baud rate and change/delete the character commands sent OUT from Arduino as appropriate):
Code:
#include <NewSoftSerial.h>

// use NewSoftSerial with RX on pin 2, TX on pin 3
NewSoftSerial mySerial (2, 3);

// a variable for keeping track of time
unsigned long start = 0;

void setup() {
// 'mySerial' is for communication with the RS-232 device via the MAX232 chip
  mySerial.begin(19200);

// 'Serial' is for communication with computer of course
  Serial.begin(19200);
}

void loop() {
// Send out a character command 'D' (followed by carriage return) to
// the device, which in my device's case tells it to reply with data
    mySerial.print('D'); mySerial.print(13,BYTE);
  
// wait up to 300 ms to see if device replies with data
    start = millis();
    while (!mySerial.available() && (millis()-start) < 300) {}

// fetch data via mySerial, then print it out on PC's serial monitor
    while (mySerial.available() ) {
        Serial.print((char)mySerial.read());
    }

// do all of this every 300 ms
  delay(300);
}
225  Using Arduino / Programming Questions / Re: basic question about NewSoftSerial on: April 09, 2011, 10:27:15 am
Quote
Quote
I have Arduino
Which one?

Paul, Very useful two-word question as it turns out!
Until now, was using a standalone Atmega 328P chip. NewSoftSerial worked with TX, failed with RX.
Tried Arduino Mega. NewSoftSerial worked with TX again, failed with RX (but non-support for Mega was stated on NewSoftSerial webpage, so wasn't surprised).

FINALLY, tried Arduino Uno. NewSoftSerial worked with TX, and with RX too... beautiful!

Good result but...
Any thoughts on why it doesn't work with standalone Atmega 328 chip / suggestions for how to make it work?
Pages: 1 ... 13 14 [15] 16 17 18