Pages: [1]   Go Down
Author Topic: Simple communication over USB to Adafruit Trinket (ATTiny85)  (Read 440 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to make a little device that will sit on my desk and flash a red LED, and make a really annoying sound with a buzzer when someone on our team commits code that causes our test suite to fail.

I bought an Adafruit Trinket thinking it would be perfect for the project, since I really only need 3 GPIO pins (one for a green LED that will be on when the test suite isn't failing), one for the red LED, and one for the buzzer.

I got all of this working pretty easily on the UNO - I simply send a 1 over serial if the test suite is failing, and a 0 if it's not.

Unfortunately, I didn't know that the trinket doesn't support serial communication like that.  I've tried the two "simple" solutions provided by Adafruit - the TrinketFakeUsbSerial, and HIDSerial.  Adafruit admits that they've never tried the TrinketFakeUsbSerial on Linux (we do use linux at work), and I can't get it work for the life of me.  HIDSerial never detects my trinket, and believe me, I've fiddled with both of them for hours (including downgrading gcc-avr just so it can recognize the --assembler-with-cpp flag, which is apparently just not there in the newest version).

I figured I'd ask here to see if someone might have some insight.  I really only need to send an "on" or an "off" signal to the trinket somehow. A 1 or a 0, a true or a false.  It could be a pin on the trinket that has power for 1, or no power for 0 (could this be possible with one of the USB pins?).

Thanks in advance!
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1409
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Take a look at the Digispark libraries, they mostly run on Trinket.  You should be able to use SoftwareSerial, too, but I seem to remember that Digispark has a smaller lib.

I have some stuff on this:
http://forum.arduino.cc/index.php?topic=192126.0
http://forum.arduino.cc/index.php?topic=187444.0

Ray
Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 249
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Since you're only looking for an on/off response, hook up the Tx line of a TTL serial adapter to one of the trinket pins, and trigger on the line going low.  Idle state for TTL serial is high, and the start bit is low, so sending any character on the serial port will do.
Logged

Unthinking respect for authority is the greatest enemy of truth - Einstein.

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Take a look at the Digispark libraries, they mostly run on Trinket.  You should be able to use SoftwareSerial, too, but I seem to remember that Digispark has a smaller lib.

I have some stuff on this:
http://forum.arduino.cc/index.php?topic=192126.0
http://forum.arduino.cc/index.php?topic=187444.0

Ray

Think I'm gonna try this out.  Do I need anything special to flash the micronucleus bootloader to the trinket?
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1409
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Do I need anything special to flash the micronucleus bootloader to the trinket?

No... just ISP from an Arduino... etc.

But, it is a one-way street with the fuses.... that is because Reset (pin1) is disabled for an extra pin.  To undo requires a HV programmer.

I removed my Reset button.

Ray
 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Do I need anything special to flash the micronucleus bootloader to the trinket?

No... just ISP from an Arduino... etc.

But, it is a one-way street with the fuses.... that is because Reset (pin1) is disabled for an extra pin.  To undo requires a HV programmer.

I removed my Reset button.

Ray
 

That's ok.  I bought two.  At that price I can brick one and I won't feel too bad.
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1409
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
That's ok.  I bought two.  At that price I can brick one and I won't feel too bad.

Or, you can build my Chachka on breadboard!
http://forum.arduino.cc/index.php?topic=187444.0

Ray

Added:
Nice thing about the Digispark is that it does give all 3 PWM signals on the t85.

Added:
Pics showing the disabling of the reset button without desoldering (unwelding?):
Simply use a watch screwdriver or probe to unspring the retainer clip.  Remove the leaf contact, the domed contact, and the actuator button.  Replace clip if you desire.  Parts can be reassembled if necessary but you will need an HV programmer to restore the fuses.


* IMG00459.jpg (43.79 KB, 336x248 - viewed 14 times.)

* IMG00462.jpg (54.07 KB, 528x400 - viewed 16 times.)
« Last Edit: January 02, 2014, 01:50:14 pm by mrburnette » Logged

Pages: [1]   Go Up
Jump to: