Connecting a piezo to 3.2.

Status
Not open for further replies.

drduval

Member
I'm trying to connect a piezo element to a Teensy 3.2, but it doesn't seem to work. No data is showing up in the Monitor or Plotter.

Code:
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A9);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}

Image of piezo connected to the Teensy 3.2. The piezo ground wire is connected to GND, and the other wire connected to a9.
https://i.imgsafe.org/385f33d011.jpg

What am I doing wrong?
 
Last edited:
Reading your question, isn't the issue more that the serial monitor doesn't work at all or do you mean that you just get a continous series of numbers?

Most likely issue with no numbers is that you don't have the serial port selected under the tools menu down towards the bottom. It may also help depending on how you installed to make sure you select device type as 'serial'. It can work without via HID but your OS may be more co-operative if the Teensy emaultes a serial port.

The next part of the problem is the connecting of the piezo, which produces very small amounts of current at quite high voltages both positive and negative so you may be better with a driver circuit. Apart from anything else it's possible to get enough voltage out of a piezo to damage chips, but first step is to make sure you can actually see results.
 
Can't seem to edit my post, but under Port Com1 is selected, and the only other option is Teensy, but it is greyed out, and not selectable.
 
Other basic check, can you load blink back to your board and have the LED start flashing again?

Com1 is almost certainly not your Teensy and is probably on the motherboard, have a look under device manager for your OS and see if you have a serial device that comes and goes when you plug/unplug the Teensy. If that's not happening but you can program the Teensy the issue is around the drivers on your OS so flavor and version would be useful.
 
Blink runs fine, the onboard LED blinks, also tested with another led connected through a breadboard.

Teensy USB Serial (COM4) is added to Ports in Device Manager.
 
Sounds like Arduino isn't updating it's devices list - suggest closing it and re-opening and see if you can get com4 as an option.
 
Status
Not open for further replies.
Back
Top