Once you have the display connected to the Trinket, you can expand the project in many ways. One of the most popular is to add sensor(s) of some sort. The Adafruit store has a wonderful selection to chose from.

The easiest place to add a sensor is to Trinket GPIO #1. GPIO pins #0 and #2 are used for the display.

On the original ATtiny85-based Trinket, #3 and #4 are shared with the USB port. Using #3 and #4 is perfectly fine, but you may have to disconnect the connections on those pins when uploading software. The Trinket M0 doesn't have this restriction, by the way.

Also, limiting a project to pins #0 to #2 gives you a similar pinout to the Adafruit Gemma M0 wearable controller.

This project demonstrates using the Maxbotix family of ultrasonic proximity sensors. These sensors are extremely flexible to interface via serial, analog, and pulse width outputs. Linking in the SoftwareSerial library with the TinyLiquidCrystal exceeds the memory available on the Trinket. The pulse output may be sensed on one digital pin and works on Trinket GPIO #1 (the one shared with the red LED). This is the connection used here. (We could also use the analog output, it could be connected to the Trinket GPIO #3 or #4 but like we said, the original Trinket has these on the USB interface too - so using these could require the connection be removed during USB programming.)

A small stick of header, 7 pins long, was soldered to the sensor to facilitate attachment to the breadboard.

See the wiring on the Fritzing diagram (first page) and the picture (second page). It is fairly easy to connect Maxbotic sensors. You use only 3 of the 7 pins on the sensor for sensing via the pulse width output:

  • Maxbotix +5 to Trinket 5V or 3V (the sensor takes a 2.5V to 5.5V supply with a 2mA typical current draw)
  • Maxbotix GND to Trinket GND
  • Sensor PW (Pulse Width) to Trinket GPIO #1

This guide was first published on Oct 01, 2013. It was last updated on Oct 01, 2013.

This page (Adding the Sensor) was last updated on Dec 01, 2021.

Text editor powered by tinymce.