SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By timgregor
#63717
I'm trying to create a simple USB device that turns on one of five leds depending on a number from a php script. There would definitly need to be so sort of application running on the users machine to pull the value from the website and send it to the AVR. Although right now I'm only concerned with getting the USB device working with a computer right now. I've been looking into the AVR-USB library and USBtiny to do what I'm trying to do. I'm very new to the AVR scene and I hear USB is a very hard thing to do with the AVR platform, and that's why I need help. If anyone feels like they could lend some time to an art student trying to create a project for school it would be greatly appreciated. I'm sure for some pro out there they could do this in a few hours, it would take me months to get even half way there.

-update: I have been looking into the FTDI chips and they might be able to do what I want because of the simplicity of what i'm trying to accomplish. I've been reading about using the chip's bit-bang mode to control up to 8 output devices, which is three more then I need. plus on their site they have code examples to drive the chips. Has anyone used these chips do do something like this?

Thanks,
Tim
By signal7
#63806
I can't say much about the FTDI solution you're evaluating, but I have played around extensively on the AT90USB1287 USB Key devel/evaluation board. Probably the most flexible USB solution that would get you up and running quickly (if you use that board) is the MyUSB library.

http://www.fourwalledcubicle.com/

BUT - I also have to say that for the simplicity of the project you're looking at, using the AT90USBKey board is major overkill. I only mention it here because it may interest you if you want to experiment with other features/capabilities of a USB capable AVR.
By timgregor
#63909
Ok I think I've come up with a solution, now I just need to learn everything else to make it work. I'm going to use an attiny45 thats running a AVR-USB USB-Serial program (this solution is cheaper and easier then a FTDI chip, plus no SMDs :D ) Then I'm going to use a Attiny2313 and read the serial command coming from the computer a 1-5 will turn on a specific port. If this codes exists please send it my way. Or if anyone has some time on their hands and would be willing to write this code for me It would be a great help. I'm a art student with no formal training in physical computing or C programming. All the device needs to do is receive a value through serial (1-5) and then turn one of 5 ports high, that corresponds with the value it received. Then wait until it gets another signal from the computer. If their is a smaller AVR that can receive serial then that could be used, from my cursory glance at the AVR specs i thought that the 2313 was the cheapest AVR that could receive serial commands.

-Tim
By signal7
#63922
From looking at the two avr's you mentioned, I think it would be possible to do the whole project using only the AtTiny2313. The AtTiny45 is very limited in the number of I/O pins it has, so you wouldn't have enough pins to drive both the LED's and the USB port at the same time. The AtTiny2313 on the other hand has more than enough I/O pins to perform the entire task.

I'm not sure why you would need two microcontrollers. If it's the serial port feature you need, using the AVR-USB library will emulate a serial port to the computer. All that would be required is to add some code to the USB-Serial program to interpret the character from the computer and turn on one of the port pins depending on what it received.

Update: I did a google search on avr-usb and serial. I found this almost immediately: http://www.obdev.at/products/avrusb/powerswitch.html
It's not exactly what you're looking for, but it's pretty darn close. There might be a pre-made solution available.
By timgregor
#63942
I looked into the power switch example on their site, The reason I chose serial is it's ease of use, both from a programming stand point and interfacing it with the computer. If Someone out their could help me with the computer programming aspect if I were to go with the one chip solution using the attiny2313 as well that would be awesome.

-Tim