Show Posts
Pages: 1 ... 11 12 [13] 14
181  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Read a botton on: June 17, 2007, 03:12:10 pm
Inside loop(), when the button  is pressed you have a "for" loop that ramps the LED from dark to bright over over about 1.5 seconds. Then you exit loop() and loop() gets called again, the button is still down, so it hits the "for" loop and again rams from dark to light.

That probably isn't what you want.

Maybe at the end of loop(), before you exit you want to wait for the button to be released, or maybe you want to make a variable to set to say "I have already turned on the LED and not yet turned it off" so you know not to ramp it up again.

182  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Turning an Arduino into a programmer on: June 01, 2007, 09:38:06 pm
Oh right. Yes, I wrote that for the upcoming 0008 release to use the fast pin access functions. You may have to wait for that or use the development code from the subversion library.

Looks like BUTTON1 in the code is the 'make an arduino' button, it is set for pin 14 (analog in 0 used as a digital pin, another 0008-ism).
183  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Turning an Arduino into a programmer on: May 27, 2007, 02:47:09 pm
Done. You can read about it in the playground, http://www.arduino.cc/playground/Code/Programmer2

I even added a handy "turn this raw chip into an arduino chip" push button.
I didn't do the "write eeprom" one.
184  Forum 2005-2010 (read only) / Frequently-Asked Questions / Turning an Arduino into a programmer on: May 25, 2007, 12:52:22 pm
Before I declare my new programmer code done and move on, I thought I'd see what features other people might like that I haven't thought of.

There are some pages around on turning an arduino into a programmer using avrisp500. I've done this and it is a fine solution for 2008. But I need one that will work when I hit "upload sketch" in 2007. To that end, I took the Arduino bootloader code and the bootcloner and fused them together into a programmer that uses the old and ill conceived stk500v1 protocol to program mega8 and mega168 devices (possibly 48 and 88 too).

From my point of view, the nice parts about a programmer like this are:
  • I don't need to put serial ports on my boards.
  • I don't need to put reset buttons on my boards, or reach over and press it to reload.
  • I don't have to wait for the bootloader timeout. Upload finishes and it runs immediately.
As fate would have it, I used the same pins for functions as the avrisp500 so you can replace its firmware to use it with avrdude if you need to do that sort of thing.

Beyond the basic programmer functions, I've added a few niceties along the way (only when running on a 168, ran out of space on an smiley-cool, but I wonder if there oughtn't be more. You can connect to the serial port directly and issue commands to do these things.
  • Examine fuses and lock bits.
  • Examine eeprom and flash
  • Remove bootloader (turn off bootrst bit)
  • Burn a test pattern into flash and eeprom
  • Erase chip
Things that could be possible but I wouldn't code unless someone thought it would be useful to them...
  • Turn virgin chip into an Arduino chip.
  • Select clock source.
  • Restore bootloader (and appropriate fuses)
  • Write eeprom
  • Echo data received over the SPI when the attached unit is running. (consumes high value pins)
  • Send characters to the attached unit over the SPI while it is running. (consumes high value pins)
  • Echo data received over the TWI when the attached unit is running. (more wires needed)
  • Send characters to the attached unit over the TWI while it is running. (more wires needed)
... but I'm sure there are people out there that use these things in different ways and will have other ideas. Let me know. In a couple days I'll declare it done, tidy up the code and post the whole mess.
185  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Boot Cloner on: May 03, 2007, 09:02:03 pm
Have you monitored the serial output while it runs? As I recall the stock boot cloner had some helpful status messages as it progressed.
186  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: trying to get some rattling action going on: May 21, 2007, 06:15:39 pm
I motor with an eccentric weight would do. Think "massager".
Alternatively, you could use a solenoid with a fair bit of weight, that would let you control the pattern of rattles better.
187  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: max7219 with 8x8 matrix on: May 11, 2007, 08:09:29 pm
Your numbers confuse me.
Quote
...my 8x8 led matrix has 12 pins, not 8 pins...
You will not be directly addressing a matrix of 64 LEDs with 12 pins. I googled your part number and found a picture purporting to be it, with 24 pins.  24 I could believe if it has two colors of LEDs at each matrix position. http://www.nb-flying.com/pdf/LED-dot-matrix.pdf.

Another possibility is that you have a serial interfaced module or some sort of latched interface. That could plausibly have 12 pins. I counted 14 on the SparkFun serial matrix backpack.
188  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: 2 baud rates require 2 arduino's? on: April 26, 2007, 06:12:39 pm
There is a SoftwareSerial library that sort of lets you do rs232 on any digital io pin. It has some limitations, but should be better in 0008. I think I'd be tempted to use an external multiplexor and use a third pin to switch my real hardware serial port back and forth between the two devices.

(A time honored technique. I have a frighteningly expensive piece of power generation gear that does this on its management interface. You can only issue commands to it within a couple milliseconds of receiving a report, after that it switches back to talking to an internal component for half a second.)
189  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Powering the ardunio from an automobile's 12V on: April 09, 2007, 10:32:50 am
My Arduino USB has a 78M05 voltage regulator on board. That has a maximum input voltage of 35V which is fine for a car. What I'm not seeing in the datasheet is anything that suggests how much power it can dissipate. It has this comforting statement:
Quote
The internal current-limiting and thermal-shutdown features of these regulators essentially make them immune to overload.
When running from your 9v power supply and drawing 500mA (the max) you will be burning off 4 volts in the regulator for a 2 watt dissipation. This works. Running from your car when the battery is charging will be something like 14 volts for a 9 volt drop, or 4.5watts. I have no idea if this will dissipate or build up to the point that the regulator safely shuts down from thermal overload.

The good news is that if you only pull, say 200mA then you'll be under 2 watts and are almost certainly fine.

I say try it.  Don't get the voltage backwards! If you think it is getting too hot then you can put a couple power diodes in series with the +12v from the car. Each one will knock off 0.7 volts or so, a nice way to make some of the power dissipate outside the Arduino's voltage regulator. Remember to stay above 9 volts on the input to give the regulator room to operate.
190  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Set all pins as output? Serial? on: April 20, 2007, 05:25:19 pm
You have to access the port directly in 0007, but you can use your analog inputs as digital pins. Something like...
Code:
DDRC |= _BV(pin);  // make port C, pin (0..5) an output
PORTC = ( (PORTC & ~_BV(pin)) | (val << pin) ) // set port c, pin 'pin' to 'val' which had better be only 0 or 1
DDRC &= ~_BV(pin); // make port C, pin (0..5) an input again, set the output value off or you will leave a pull up resistor turned on that will mess up your analog reads.

if ( PINC & _BV(pin)) {  // if port C, pin (0..5) is set...
... just the thing for a pin junky.
191  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: 2 led displays on: April 18, 2007, 10:47:15 pm
There are plenty of pins if you are using some sort of serial interfaced display. It might be tight if you are using one with a parallel interface, but if there is a "chip select" pin and the displays are otherwise identical you only need one extra pin for the second display. 12 digital pins are easy, 14 if you don't use anything else like a serial port, 20 aren't hard if you work at it.


The ATmega8 can be programmed to use an internal clock at 1, 2, 4, or 8 MHz. The Arduino environment doesn't offer support, but you could recompile the bootloader and load it in then reprogram the fuses of the device and it would work. This clock is only accurate to 3%, but can be trimmed to be accurate to 1% in some circumstances. I think you'd be OK for rs232 serial communication at 3%, but it doesn't leave a lot of safety margin.
192  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Static electricity? Fried board? on: April 11, 2007, 09:20:21 pm
The digital inputs have such large resistance that if you do not tie them high or low with a resistor they will float in the middle. Their level will depend on how many electrons are trapped on them. This is easily changed by a static charged touch.

Wire up the switch and resistor and everything will be good.
193  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: sketches on attiny2313 on: April 08, 2007, 11:05:01 am
Arduino sketches are bigger than 2k. The serial bootloader alone is 1k. You could use an ICSP instead of the bootloader and save that space.

The simple "blink a single led on and off" example takes 3676 bytes in Arduino-0007 so that is out. The in-development Arduino-0008 code blinks an LED in 876 bytes, so that might be possible, but any libraries would probably put you over the top. You won't be able to use the serial port library, for example.

RAM space is also going to be a problem.
194  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Help. on: April 07, 2007, 08:38:52 am
I'd recommend starting with at least one official Arduino so you have a known device to learn how things work, from there...

You can use an Arduino to put a bootstrap loader into other chips.
http://www.arduino.cc/playground/BootCloner/BootCloner

The schematics are in the hardware section if you want to make your own Arduino. It is simple enough that you can put it together on a prototyping board. The part that gets complicated is if you want the USB<->RS232 converter. These don't come in DIP packages. I'm not sure if there is one that works at 5V, but I've used a Nokia cell phone data cable in other cases. Some models of these are just USB<->3.3v RS232 converter cables.

If you are cost sensitive and close enough to the US, SparkFun sells the Olimex 28 pin AVR board for $16 (+$4 for an Atmega8) http://www.sparkfun.com/commerce/product_info.php?products_id=29 It is serial interfaced instead of USB and its LED is in a funny spot from the Arduino perspective, but it has a good amount of holes for piecing things together. You'll probably want to put in a 16MHz crystal so you don't have to mess with making a different boot loader image. And you have to connect the RX and TX pins to the level converter on board. Remember to cross them.
195  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Using several accelerometers, feasibility? on: March 28, 2007, 06:21:58 pm
I haven't used those accelerometers, but from a quick look at at the specs and code...

It will take 20ms worst case to get a reading. If you need two axis on 7 cups that will be 14 readings, or 280 milliseconds. You could sample the who setup about 4 times a second. With really clever coding you could double that rate by watching several of them at once.

There are 14 inputs, but if you used them all you would have no outputs to do anything, you would have consumed your serial port.  Fortunately there are devices called multiplexors which allow you to select one of many inputs. You could use a 16 channel multiplexor (MUX), that would take 4 outputs to tell it which channel you wanted then only 1 for an input leaving you plenty of pins for other functions.

There are also analog multiplexors if you went with analog sensors. You could probably get a higher sample rate this way if that was an issue.

And ah, the best.... Will people rip it apart? Absolutely! If it is possible they will rip it apart. Theymay not mean to, but it will happen. I might experiment with using a low stretch, braided sheath rope of the sort used by small sailboat sailors. This has a braided cover in a pretty color with a core of straight, very strong fibers. You can easily get hundreds of pounds of breaking strength in a few millimeters of rope diameter, but the best part is when you 'scrunch' the sheath a bit it gets bigger and you can snake a couple twisted pairs through the inside where they are protected. If you are very clever with your knot work you could encase the sensor in the rope as it is tied around the handle of the bowl... assuming they have handles... otherwise you will have to glue it on somewhere and hope for the best.
Pages: 1 ... 11 12 [13] 14