Show Posts
Pages: [1] 2 3 ... 21
1  Using Arduino / Motors, Mechanics, and Power / Re: Help me pick a motor driver on: February 20, 2013, 02:34:50 pm
I should clarify a bit. I was hoping for at least a basic level of integrated functionality, i.e. overcurrent protection, etc. I did mention PWM in the OP but it would also be nice to have a driver that worked on I2C or some other serial format and allowed for different output PWM frquencies than what you get the from the Arduino itself (I've had motors run off an Arduino and transistor that hummed or growled due to the rather low PWM frequency).
2  Using Arduino / Motors, Mechanics, and Power / Help me pick a motor driver on: February 20, 2013, 08:23:27 am
Looking for a suggestion for a chip to use in a motor driver. I will have an Arduino providing an input signal (not picky about format, probably PWM). The motor is brushed DC, 24v, 1.8A max. Don't care about bidirectional control. Don't care about package, just want something reasonably easy to solder by hand. Smallish size would be nice as the pcb is cramped already.

Seems like most of the chips out there either have functions I don't want, or are dual H bridges, which is more capability than I need (I only need one motor, in one direction). And there's tons of chips to wade through. Anyone have a suggestion?
3  Using Arduino / Project Guidance / Re: Pushbutton rotary encoder with only one pin? on: March 27, 2012, 11:04:57 am

However if you connect the common terminal to an analog pin, and via a 10k resistor to ground, then each of the other pins can be fed +5V via a different value resistor (say 4k7, 10k, 22k) then you will get a unique voltage at the analog pin for each of the 8 possible states I think...

This is what I had in mind, more or less.

I really doubt that an analog read would be anywhere near fast enough to catch a rotary encoder.

Care to explain? How fast does something need to be to catch a rotary encoder? This will be an input on a UI, i.e. a human will be turning a knob.
4  Using Arduino / Project Guidance / Pushbutton rotary encoder with only one pin? on: March 27, 2012, 08:31:16 am
Hello all,

I currently have a project with a user interface that consists of an LCD screen and a small number of momentary pushbuttons. Users interact with the buttons to control the behavior of the device.

The buttons are a bit awkward, which has me thinking about replacing them with a pushbutton rotary encoder. The user would scroll through menus by turning the encoder, click it to choose a setting, then spin the encoder to increment or decrement the value. I can picture this having a sort of ipod-like simplicity and I really like it.

However, I don't have a bunch of free pins sitting around. The pushbuttons are working on an analog input pin with a series of resistors acting as voltage dividers such that I can detect which button was pushed and act accordingly. Has anyone ever done this approach with a rotary encoder? Does it strike anyone as being within the realm of possibility?

I've seen the rotary encoder page on the playground:

but after a quick scan it looks like all of those examples require multiple pins (worst case, interrupt pins). I don't care a ton about accuracy or speed. I have no experience with rotary encoders so I plan on experimenting a bit with this, but I figured I'd throw the question out to see if someone else had already solved this. Looking at the graph of "a" and "b" waveforms in the first example in the playground, it strikes me that you could put the two on one pin with a resistor divider, and then just work out the maths to determine which transitions indicated which state(s) for the encoder.
5  Development / Other Hardware Development / Favorite I2C Digital Pot? on: September 22, 2011, 01:33:36 pm
Hello all,

Just wondering if the forum has a favorite I2C digital potentiometer. I know the DigitalPotentiometer example is written for the AD5171, but that chip is a little small (SOT23-8) and not highly available.

The chip has to be I2C. Bonus points for chips that meet these criteria:

a) 1 - 2 channels
b) easy SMT package, i.e. SOIC or something with reasonable pitch
c) easy to find at lots of suppliers
d) reasonably priced, i.e. less than a few bucks
e) code already well developed/supported

Any ideas?
6  Forum 2005-2010 (read only) / Troubleshooting / Re: Another Loop Breaking Problem on: September 17, 2009, 01:49:12 pm

I'm working on a similar problem but don't quite have it sorted yet. However, maybe I can help a bit, since I've taken the route Spinlock suggested.

Basically, you need to add some variables to Spinlock's example to keep track of "where" in your fade you are for each iteration.

Let's say for function 1, you want to fade from 0 - 255 X amount of times at a certain rate a, and for function 2, you want to fade from 0 - 255 Y amount of times at a different rate, b.

The approach I took is to write a single generic "fade" function that takes in the led pin, the desired amount of fades, the desired fade rate, and two variables to describe the point in the whole function the led was at for the last iteration of the main loop. Then, it figures out if the led should be fading (and by how much) or turning off, and does an analogwrite to the pin. It then increments the "state" variables, so the next time through the loop, it knows where to pick up from.

You could take this same approach. In the beginning of your main loop, you would check for an H or L from the wireless chip.

The H or L signals from the wireless chip would reset the "state" variables and the variables to indicate fade rate and number of blinks. Then, pass all these variables to the fade function, and the led responds accordingly. Next time through the loop, it'll either pick up where it left off from (it knows this thanks to the state variables), or abandon the current state and switch to the other desired fade sequence if a different value has been received from the wireless chip.

This is a really shoddy plain-english explanation, hopefully it makes sense.
7  Forum 2005-2010 (read only) / Syntax & Programs / Re: Twitter and the ENC28J60 on: April 28, 2010, 08:50:25 am
I think I've gotten around the issue, but I don't understand the details.

The code in the pde was calling some functions that, in the library files, were surrounded by if statements. I commented those statements out (in enc28j60.h, enc20j60.h, websrv_help_functions.h, websrv_help_functions.c). The example sketch now compiles. I don't have the hardware soldered up yet so I can't see if it actually works, but at least it compiles.

I'm a neophyte when it comes to library development, so I'm not sure what those if statements were there for. It looked like they were intended to only include certain blocks of code if certain functionality was desired, or something along those lines.

Once I get the hardware finished I'll report back if it works or not.
8  Forum 2005-2010 (read only) / Syntax & Programs / Re: Twitter and the ENC28J60 on: April 27, 2010, 03:55:42 pm
Digging this up from the dead in the hopes that AndyL sees it. I'm planning on using an ENC28J60-based Ethernet interface to post messages to twitter. I downloaded the zip file in the blog post you linked, loaded it in arduino-018, and tried to compile the twitter example. I get this:

In function 'int8_t analyse_get_url(char*)':
error: 'class EtherShield' has no member named 'ES_find_key_val' In function 'void loop()':

I saw that a user on your blog had the same issue but didn't see that there was any resolution. Wondering where to start troubleshooting?
9  Forum 2005-2010 (read only) / Development / Re: What does it mean? on: August 11, 2010, 10:14:36 am
The comments in the code give a line by line explanation. Is there any part in particular that you do not understand? Or any overall concepts you are having trouble with? Answering those questions will let us know what needs to be explained in more detail.
10  Forum 2005-2010 (read only) / Development / Re: Abstration of the EEPROM library? on: August 11, 2010, 10:31:09 am
It works. Thanks again. The best part was that it was so painfully easy to incorporate. All I had to do was add the include and change the lines where I declared the variables. All other code remained untouched and seems to be working perfectly.
11  Forum 2005-2010 (read only) / Development / Re: Abstration of the EEPROM library? on: August 11, 2010, 10:24:46 am
AlphaBeta, it does look like that does exactly what I wanted, thanks very much. I will incorporate it into my code and report back.

Senso, good point, this is definitely "dangerous" in a sense but I don't see how it's any more or less dangerous  than implementing with just the standard EEPROM library? At any rate, I'm not too worried in my application, since the only time these variables will be changed will be when unique button presses happen.
12  Forum 2005-2010 (read only) / Development / Abstration of the EEPROM library? on: August 10, 2010, 11:02:05 am
Hello all,

I have an application where a user configures some settings through a UI (16x2 LCD and a few buttons) and then lets an Arduino chug away turning things on and off according to the settings. I'd like to store these settings in the onboard EEPROM, so they were preserved during power outages, but I can't think of a "clean" way to do it.

I'm wondering - are there any libraries out there that "abstract" EEPROM usage? Ideally, I'd love it if there was a library that allowed me to:

1) Declare variables of any type and designate them as "EEPROM" variables
2) Read the value of that variable from memory during start up
3) Write the value of that variable to EEPROM any time it changed
4) Automatically handle all the "messy" stuff like keeping track of memory addresses, converting between data types, etc. so I don't have to worry about it.

Anything like that exist?
13  Forum 2005-2010 (read only) / Troubleshooting / Re: arduino problems on: August 04, 2010, 09:23:27 am
It's buzzing when you turn it on because buttonPushCounter % 4 == 0 when buttonPushCounter == 0 as PaulS showed above. Modify this statement:

if (buttonPushCounter % 4 == 0)

like this:

if (buttonPushCounter % 4 == 0 && buttonPushCounter > 0)

Also, you said you only want it to sound for one second. You could implement that with a delay after you turn it on:

if (buttonPushCounter % 4 == 0 && buttonPushCounter > 0) {
   digitalWrite(ledPin, HIGH);


Or by setting a variable to millis() when you turn it on, then turning it off when millis() -1000 > your variable.
14  Forum 2005-2010 (read only) / Troubleshooting / Re: I2C Display on: August 28, 2009, 08:28:15 am
Good to know, thanks.
15  Forum 2005-2010 (read only) / Troubleshooting / Re: I2C Display on: August 28, 2009, 07:21:22 am
I would also add a 3K3 pull up resistor on each I2C line.

Even though the arduino supposedly uses internal pullups on analog 4 and 5 when you use I2C? My only I2C experience is with an RTC, which worked with and without external pullup resistors. (I had them in the circuit since many I2C examples show them, but then removed them after I read about the internal resistors.) Would there be different cases when you would or wouldn't add external pullup resistors, or is it a case by case, trial and error thing?
Pages: [1] 2 3 ... 21