Arduino Projects!

Topics generally related to Twin Cities Maker activities
User avatar
wammie
Site Admin
Posts: 1444
Joined: Sat Mar 14, 2009 4:14 pm
Location: Minneapolis, Minnesota
Contact:

Arduino Projects!

Postby wammie » Mon Jul 13, 2009 11:37 am

Here's a new thread to document and collaborate on Arduino projects!

Now that I have a Duemilanove Arduino, I'm bewitched, bothered, and bewildered. There's a universe of stuff to do with it!

I have a LOT of very cool chips and components to use with it: SN76477 synthesizer chips, op amps, CMOS logic chips, some photocells, a phototransistor, (power) transistors, magnets, hobby motors, diodes, zener diodes (I have dozens of 6.8V zeners!), resistors, capacitors, solenoids, etc.

Post here if you've built a cool Arduino project or have suggestions for others, esp. beginners!

meat_raffle
Posts: 47
Joined: Wed Jan 14, 2009 10:01 am

Re: Arduino Projects!

Postby meat_raffle » Mon Jul 13, 2009 12:43 pm

I've had an Arduino Duemilanove for a few months now. Very fun little micro.
I've been able to talk to a Real Time Clock, a Temp Sensor, a 2X20 LCD and a Stepper Motor using an EasyDriver.
Example code for all of those can be found online.

I've been able to get a serial link working via LabVIEW to log ADC and temp sensor data.
I'm not a C programmer, but with lots of searching on the Arduino Fourms and help from co-workers I can usually get things to work.
Someday I'd like to build an Etch-a-Sketch clock.

User avatar
wammie
Site Admin
Posts: 1444
Joined: Sat Mar 14, 2009 4:14 pm
Location: Minneapolis, Minnesota
Contact:

Re: Arduino Projects!

Postby wammie » Mon Jul 13, 2009 1:09 pm

Cool, meat_raffle!

Well I just did one of the easy experiments that blinks an LED with PWM based on a pot slider position, but substituted a photocell and resistor for the pot. Works fine; the LED blinks faster when it receives a higher light level!

User avatar
wammie
Site Admin
Posts: 1444
Joined: Sat Mar 14, 2009 4:14 pm
Location: Minneapolis, Minnesota
Contact:

Re: Arduino Projects!

Postby wammie » Mon Jul 13, 2009 1:27 pm

I'm contemplating a somewhat involved project too. For this, I'll need to write a digital byte to eight of the I/O pins on the Arduino. From the Arduino Programming Notebook, I find the following:

Code: Select all

digitalWrite(pin, HIGH); // sets 'pin' to high

Isn't there a way to write a byte of data all at once to eight pins, instead of having to write to each of the individual pins?

meat_raffle
Posts: 47
Joined: Wed Jan 14, 2009 10:01 am

Re: Arduino Projects!

Postby meat_raffle » Mon Jul 13, 2009 1:47 pm

I've not seen anything along the lines of a "port write/read" for the Arduino, but I do it all the time in LabVIEW.
Perhaps there is a library out there that could do it?

User avatar
wammie
Site Admin
Posts: 1444
Joined: Sat Mar 14, 2009 4:14 pm
Location: Minneapolis, Minnesota
Contact:

Re: Arduino Projects!

Postby wammie » Mon Jul 13, 2009 2:22 pm

Yeah, seems there is. I found information on digital port use here:
http://www.arduino.cc/en/Reference/PortManipulation

But the resource discourages byte-wise manipulation for the following reasons:
The code is much more difficult for you to debug and maintain, and is a lot harder for other people to understand. It only takes a few microseconds for the processor to execute code, but it might take hours for you to figure out why it isn't working right and fix it! Your time is valuable, right? But the computer's time is very cheap, measured in the cost of the electricity you feed it. Usually it is much better to write code the most obvious way.

The code is less portable. If you use digitalRead() and digitalWrite(), it is much easier to write code that will run on all of the Atmel microcontrollers, whereas the control and port registers can be different on each kind of microcontroller.

It is a lot easier to cause unintentional malfunctions with direct port access. Notice how the line DDRD = B11111110; above mentions that it must leave pin 0 as an input pin. Pin 0 is the receive line (RX) on the serial port. It would be very easy to accidentally cause your serial port to stop working by changing pin 0 into an output pin! Now that would be very confusing when you suddenly are unable to receive serial data, wouldn't it?

So you might be saying to yourself, great, why would I ever want to use this stuff then? Here are some of the positive aspects of direct port access:

You may need to be able to turn pins on and off very quickly, meaning within fractions of a microsecond. If you look at the source code in lib/targets/arduino/wiring.c, you will see that digitalRead() and digitalWrite() are each about a dozen or so lines of code, which get compiled into quite a few machine instructions. Each machine instruction requires one clock cycle at 16MHz, which can add up in time-sensitive applications. Direct port access can do the same job in a lot fewer clock cycles.

Sometimes you might need to set multiple output pins at exactly the same time. Calling digitalWrite(10,HIGH); followed by digitalWrite(11,HIGH); will cause pin 10 to go HIGH several microseconds before pin 11, which may confuse certain time-sensitive external digital circuits you have hooked up. Alternatively, you could set both pins high at exactly the same moment in time using PORTB |= B1100;

If you are running low on program memory, you can use these tricks to make your code smaller. It requires a lot fewer bytes of compiled code to simultaneously write a bunch of hardware pins simultaneously via the port registers than it would using a for loop to set each pin separately. In some cases, this might make the difference between your program fitting in flash memory or not!

User avatar
DanBackslide
Posts: 217
Joined: Sun Jan 18, 2009 11:06 am
Location: Brooklyn Park, MN (EN35ic)
Contact:

Re: Arduino Projects!

Postby DanBackslide » Mon Jul 13, 2009 8:39 pm

My steampunk ghost detector is controlled by an Arduino. Lights, a meter and a hobby servo (inside the big meter), a "power switch" to put it all in a quiet mode, and a hidden button to make it detect a ghost.

I just got a Smokenator 1000, and now I have this idea to build a temperature sensing rig using a thermocouple and some kind of display. And maybe an Xbee module to pipe the temp data inside, to another display. And maybe to a logger, so I can graph the temp...
73 de KC0DZY

User avatar
wammie
Site Admin
Posts: 1444
Joined: Sat Mar 14, 2009 4:14 pm
Location: Minneapolis, Minnesota
Contact:

Re: Arduino Projects!

Postby wammie » Tue Jul 14, 2009 8:34 am

DanBackslide wrote:My steampunk ghost detector is controlled by an Arduino. Lights, a meter and a hobby servo (inside the big meter), a "power switch" to put it all in a quiet mode, and a hidden button to make it detect a ghost.

I just got a Smokenator 1000, and now I have this idea to build a temperature sensing rig using a thermocouple and some kind of display. And maybe an Xbee module to pipe the temp data inside, to another display. And maybe to a logger, so I can graph the temp...

Oooohhhh! Your steampunk ghost detector makes me giddy! :D :D :D . I love steampunk! Man, I'm going to build something spectacularly steampunk with my Arduino sometime, I'm sure! Mwhahahahahahaaaaaaaa!

Another project I had in mind would need to read data off of a USB thumb drive... I'm looking for code for that. Like everyone else though, I tend to want to run before I learn how to crawl, so I'm taking some time to learn the basics first.

uptownmaker
Posts: 378
Joined: Tue Jan 13, 2009 8:26 am

Re: Arduino Projects!

Postby uptownmaker » Tue Jul 14, 2009 11:11 am

I'll save you some trouble, Wayne- the Arduino can't read a USB drive.

Somebody MIGHT release a shield that will allow it to do so, but that would be a very expensive and complex shield.

I'd look into SD cards- that should be do-able, and I bet there's a shield out there that'll do it.

User avatar
DanBackslide
Posts: 217
Joined: Sun Jan 18, 2009 11:06 am
Location: Brooklyn Park, MN (EN35ic)
Contact:

Re: Arduino Projects!

Postby DanBackslide » Tue Jul 14, 2009 8:15 pm

FTDI makes a couple of devices that can read from USB flash drives. They have both serial and SPI interfaces:

Vinculum Vmusic2
Vinculum Vdisk2

I have a Vmusic2, but I have not made it work yet with the Arduino. This is mostly because I have no idea what I'm doing...
73 de KC0DZY


Return to “General Discussion”

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 2 guests

cron