SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on the software and hardware for Atmel's STK standard.
By gen
#75818
I must be missing something, exactly what software do I use to upload the sample code to the EL Sequencer? I'm using the FTDI basic breakout board for serial com-yes, the driver is loaded.

I've played with alot of different AVRs, most recently an arduino. Can I use the editor/loader on the arduino site, is that what is meant in the specs "arduino (8mhz lillypad) compatable"? Or am supposed to use AVRstudio4 with the soundfordge AVR-GCC(the sample code has an avrdude make file)? Is the controller programmed with a bootloader? Does it need one?

Most of the other projects/boards had clearer instructions. Help!

Paul
By Exavior
#76084
Myself and a few coworkers have been trying to find the answer to that question all morning... There does not seem to be any information on sparkfun about how this board is programmed... especially given the fact that the board appears to have no mounted components for connecting to a computer or external microcontroller.

Checked all the usual places for information (forum, comments, google, youtube, and even flickr) with no luck.

Hopefully some documentation will be posted soon.
User avatar
By Chupa
#76088
There is a footprint for a 6pin ISP header on the board. It dose not have a bootloader, its just a regular old AVR. You will need an AVR programmer to change the code on the chip.

What ever program you use to make the code is up to you (AVR Studio and winAVR GCC, straight ASM, IAR, or otherwise). But you will need a AVR ISP capable programmer to put the code onto the AVR on that board.
By Exavior
#76091
Is it possible to program this board with an Arduino?
User avatar
By Chupa
#76112
The better question is can you use the Arduino as an ISP programmer. Google turned up this http://tinker.it/now/2006/12/04/turn-ar ... rogrammer/

If that article is true and it is possible to use your arduino as an ISP programmer then you can use that to program the AVR on that EL board.

I do not have or use arduinos so i do not know if its true or not, it looks legit though.
By cspurgeon
#76537
I swapped emails with a Sparkfun customer rep, and he says an Arduino breakout board to control ELs is in the works. Hopefully not too long!
By brent_c
#77228
I just picked this up and have the same question... has there been any response from the sparkfun team on how to actually use this thing? I should have paid a lot more attention before I picked this thing up....

How do i get this thing either bootloaded so I can program it with the arduino system (I think that's what the "lilypad compatible statement meant") or directly program the thing?
By brent_c
#77258
So, make sure you download and install the FTDI drivers as appropriate for your system, then fire up the arduino software.

Make sure the appropriate port is selected, and set the board to "lilypad".

Code uploads like a champ.
By hopper1068
#77759
I have the EL Sequencer and a 3.3v FTDI breakout. I could successfully push down arduino sketches but couldn't seem to figure out how to control the A-H channels.

So I decided to switch over to a pure C and winAVR approach. I updated my eclipse environment with the AVR plugin, which uses winAVR tools behind the scenes. It was really easy to create a new AVR C application and paste the sparkfun code into a main.c. But I ran into trouble trying to figure out what type of hardware to configure it for(avrdude stuff).

I found an article on ladyada (http://www.ladyada.net/library/arduino/bootloader.html) and found a configuration that appears to work:

With this, I get a decent output coming back from avrdude:

Code: Select all
C:\mystuff\MyProjects\NeonHelloWorld\Debug>avrdude -pm168 -cavrisp -P//./COM31 NeonHelloWorld.elf -Uflash:w:NeonHelloWorld.hex:a -v -b19200 -F

avrdude: Version 5.6, compiled on Mar  5 2009 at 09:59:30
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "C:\WinAVR-20090313\bin\avrdude.conf"


         Using Port                    : //./COM31
         Using Programmer              : avrisp
         Overriding Baud Rate          : 19200
         AVR Part                      : ATMEGA168
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page
      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  Max
W   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
           eeprom        65     5     4    0 no        512    4      0  3600  36
00 0xff 0xff
           flash         65     6   128    0 yes     16384  128    128  4500  45
00 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0
 0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0
 0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel AVR ISP
         Hardware Version: 2
         Firmware Version: 1.16
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.05s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA168 is 1E 94 06
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "NeonHelloWorld.hex"
avrdude: input file NeonHelloWorld.hex auto detected as Intel Hex
avrdude: writing flash (1584 bytes):

Writing | ################################################## | 100% 1.42s

avrdude: 1584 bytes of flash written
avrdude: verifying flash memory against NeonHelloWorld.hex:
avrdude: load data flash data from input file NeonHelloWorld.hex:
avrdude: input file NeonHelloWorld.hex auto detected as Intel Hex
avrdude: input file NeonHelloWorld.hex contains 1584 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.20s

avrdude: verifying ...
avrdude: 1584 bytes of flash verified

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK

avrdude done.  Thank you.


C:\mystuff\MyProjects\NeonHelloWorld\Debug>
Note that I have to ignore the device signature (-F) to get it to work. I have not verified that this actually worked - I'm running out of "weekend" but wanted to post my results.

I also noticed that I had to reboot my el sequencer board every time when I was trying different configurations. It flashes the LED rapidly 7 times on boot up, and then it's ready to accept an update.

Now if I can figure out how to make the LED blink, I can verify that the code actually works! (Don't have my neon wire - my son went to band camp today, and took the ac inverter and neon wire with him - we made a "neon man" that he wanted to show off.)

Hope this helps someone else. I've seen a lot of posts about this topic, but with no good concrete results.
By hopper1068
#77806
It works! I used this article to figure out how to make the LED work. I can successfully light up the LED now. Here's the modified sparkfun code. Note that I still don't have any neon wire or inverter, so have not tested that part yet. And my ledOn() and ledOff() functions aren't friendly to the current state of the neon wire. They should only modify bit 5's state, not all bits of the port.
Code: Select all
/*
    EL Driver test code
	Pete Dokter, 5/20/09
	
*/

#include <avr/io.h>
#include <avr/interrupt.h>

#define EL_G 0	//PB0
#define EL_H 1	//PB1

#define EL_A 0	//PC0
#define EL_B 1	//PC1
#define EL_C 2	//PC2
#define EL_D 3	//PC3
#define EL_E 4	//PC4
#define EL_F 5	//PC5

#define LED  5	//PB5


//Define functions
//======================
void ioinit(void);      //Initializes IO
void delay_ms(uint16_t x); //General purpose delay
void delay_us(int x);

void ledOn();
void ledOff();

void pulse(char line, int speed);
void cycle(int speed);
void line_on(char line);//send 'A' through 'H'
void line_off(char line);//send 'A' through 'H'

//======================

static char line_on_1 = 0;
static char line_on_2 = 0;


int main (void)
{
	int x;

    ioinit(); //Setup IO pins and defaults
	
	delay_ms(5000);
	
	while(1)
	{
		delay_ms(1000);

		ledOn();

		for (x = 0; x < 4; x++)
		{
			pulse('A',125);
			delay_ms(100);
		}
			
		for (x = 10000; x < 25000; x+=1000)
		{
			cycle(x);
		}
		
		for (x = 25000; x < 32000; x+=200)
		{
			cycle(x);
		}
		
		for (x = 0; x < 1600; x++)
		{
			cycle(32000);
		}

		for (x = 0; x < 15; x++)
		{
			line_on('F');
			delay_ms(20);
			line_on('B');
			delay_ms(20);
			line_on('H');
			delay_ms(20);
			line_on('E');
			delay_ms(20);
			line_on('C');
			delay_ms(20);
			line_on('A');
			delay_ms(20);
			line_on('D');
			delay_ms(20);
			line_on('G');
			delay_ms(20);
			
		}
		
		line_off('D');
		line_off('G');
		
		for (x = 0; x < 4; x++)
		{
			pulse('A',250);
			delay_ms(100);
		}

		
		ledOff();
	}
	
	
}

void ioinit (void)
{
	//brent_c's update:
	PORTB = 0; 
	DDRB = 0x23; 
	    
	PORTC = 0; 
	DDRC = 0x3F; 
	
    TCCR2B = (1<<CS21); //Set Prescaler to 8. CS21=1
}


//General short delays
void delay_us(int x)
{
	int y, z, a;
	
	y = x/256;
	z = x - y * 256;
	
	for (a = 0; a < y; a++)
	{
		TIFR2 |= 0x01;//Clear any interrupt flags on Timer2
		
		TCNT2 = 0; //256 - 125 = 131 : Preload timer 2 for x clicks. Should be 1us per click
	
		while(!(TIFR2 & 0x01));
		
	}
	
	TIFR2 |= 0x01;//Clear any interrupt flags on Timer2
	
	TCNT2 = 256-z; //256 - 125 = 131 : Preload timer 2 for x clicks. Should be 1us per click

	while(!(TIFR2 & 0x01));
	
}

//General short delays
void delay_ms(uint16_t x)
{
	for (; x > 0 ; x--)
    {
        delay_us(250);
        delay_us(250);
        delay_us(250);
        delay_us(250);
    }
	
}


void pulse(char line, int speed)
{
	int x;
	
	for (x = 0; x < 10000; x+=speed)
	{
		line_on(line);
		delay_us(x + 100);
		line_off(line);
		delay_us(10000 - x);
	}

	for (x = 0; x < 10000; x+=speed)
	{
		line_on(line);
		delay_us(10100 - x);
		line_off(line);
		delay_us(x + 100);
	}
	
}


void line_on(char line)//send 'A' through 'H'
{
	char temp;
	
	if (line_on_2 != 0) line_off(line_on_2);//can't have more than one line on at a time
	
	//keep track of what's on and in what sequence
	line_on_2 = line_on_1;
	line_on_1 = line;

	temp = line - 65;
	
	if (temp < 6) DDRC |= (1<<temp);
	else DDRB |= (1<<(temp-6));

}


void line_off(char line)//send 'A' through 'H'
{
	char temp;
	
	if (line == line_on_2) line_on_2 = 0;
	else if (line == line_on_1)
	{
		line_on_1 = line_on_2;
		line_on_2 = 0;
	}
	
	temp = line - 65;
	
	if (temp < 6) DDRC &= ~(1<<temp);
	else DDRB &= ~(1<<(temp-6));

}

void cycle(int speed)
{
	int x;
	
	if (speed > 32000) speed = 32000;
	
	for (x = 65; x < 72; x++)
	{
		line_on(x);
		delay_us(32100 - speed);
	}
	
	for (x = 72; x >= 65; x--)
	{
		line_on(x);
		delay_us(32100 - speed);
	}
	
	line_off('B');
	delay_us(32100 - speed);
	line_off('A');
}

void ledOn(){
	PORTB = 0xFF;
}

void ledOff(){
	PORTB = 0x00;
}
By inventore123
#77820
Just a suggestion: you don't need to write the delay_ms and delay_us functions, they are available in the avr C library. Just do this:

//Xtal frequency: used to calibrate delays
#define F_CPU 8000000UL

#include <util/delay.h>

and then you can use _delay_ms() and _delay_us()
By BretMattingly
#93024
Not to resurrect a dead topic, but I'd like to purchase the EL sequencer rather than the Escudo. Have we determined that this can be programmed with the Arduino environment? I have the FTDI breakout board and drivers installed.
By shardy
#93393
BretMattingly wrote:Not to resurrect a dead topic, but I'd like to purchase the EL sequencer rather than the Escudo. Have we determined that this can be programmed with the Arduino environment? I have the FTDI breakout board and drivers installed.
Yes, it can. Works just like an Arduino, can program it using a standard FTDI cable/board.

Only thing: I had a bit of trouble figuring out how to actually get it to work, and the software library included... well, just doesn't work. The EL Sequencer is different in a number of ways than the El Escudo, specifically around pin mapping.

Here's some code that I wrote. See http://site3.ca/projects/el-sequencer-sign/ for specific details on what I used it for. I took the fade code out of the library and put it right into my sketch, changing slightly to account for different pins (using the analog pins instead of A-H).
Code: Select all
void setup()   {                
  int i;
  for(i=14;i<=17;i++) { pinMode(i, OUTPUT); digitalWrite(i, LOW); }   
}

void loop()                     
{
  int i;
  for(i=14;i<=17;i++) {
    fade_in(i);
    delay(1000);
    fade_out(i);
    delay(1000);
  }   
}

#define pulse_width 5

void fade_in(int channel)
{
        for(int brightness=0; brightness<=pulse_width; brightness++){
                for(int duration=0; duration<5; duration++){
                        digitalWrite(channel, HIGH);
                        delay(brightness);
                        digitalWrite(channel, LOW);
                        delay(pulse_width-brightness);
                }
        }
        digitalWrite(channel, HIGH);
}

void fade_out(int channel)
{
        for(int brightness=pulse_width; brightness>=0; brightness--){
                for(int duration=0; duration<5; duration++){
                        digitalWrite(channel, HIGH);
                        delay(brightness);
                        digitalWrite(channel, LOW);
                        delay(pulse_width-brightness);
                }
        }
}
I hope this helps!
By BretMattingly
#93402
Funny, your code looks VERY similar to the stuff I drafted up on paper today, particular.

Mine just came in today (SFE Tech Support confirmed the FTDI could program it). I was comparing notes on the EL Escudo library to the Heartbeat Jacket tutorial, and just like you, I found something was afoul.

The straitjacket tutorial said that the TRIAC was turned on by setting the channel pin HIGH.

The Escudo library turns the pin LOW?

I haven't gotten to test it yet, but my money's on the first one. Looks like your code works, though I haven't determined from your code that HIGH is on and LOW is off. Is that the case?

Cool project, btw! And as it happens, I AM making an EL mask. Great minds?
By shardy
#93420
Yup, wire is active high, and off low.

The El Escudo library is on a different computer so I can't check right now, but I wouldn't be surprised if the library turns the pin low to turn the wire on. I remember looking at that code a few times and wondering "...does this even work? Has anyone ever tested this?" I gave up on it very quickly though when I realized that the EL Sequencer board is entirely incompatible with the EL Escudo code ("why is it referencing those pins with A - H?").

What kind of mask are you working on? I assembled a mask from a gas mask which I lit up with red LEDs inside the eyes and a cap where I wove in 50 lengths of 2' wire on four channels for hair. Attaching a more powerful inverter that would drive 25' or so of wire just didn't work when connected through the EL Sequencer. At that point I was running out of time, so I just used four separate inverters and didn't go for the fade effects I wanted. I'm actually thinking of putting together a board similar to the EL Sequencer but adding a few features (onboard inverter, chainable, controlled by an external Arduino).

Best of luck with your project, post some project details when you're done!