Hi I am trying to use a Seeduino XIAO RP2040 to convert a quadrature encoder signal into a simple 3 channel rotational hall sensor. The first problem I have ran into is that the board will not pick up the output signal from the encoder.
I verified the problem using the following basic code:
// Test that the pins are being read correctly
void setup() {
//start serial connection
Serial.begin(9600);
//configure pin 7
pinMode(7, INPUT);
}
void loop() {
// Read pin and store value
int sensorVal = digitalRead(7);
// If pin is High print 1
if (sensorVal == HIGH) {
Serial.println("1");
}
}
When rotating the encoder by hand I can confirm, with an oscilliscope, that the pin is getting approximately 5v for a brief moment as the encoder rotates. Unfortunately when running this code the board never recognizes the input and nothing prints to the screen when I turn the encoder by hand.
Is there a problem with my code?
The signal is only on for about 500 microseconds, is that too short of a time to be picked up?
Oh then I must have fried the processor because I have been trying to use it with a 5V signal. I'm surprised because I have seen this same board wired directly to a 5V encoder signal with an off the shelf wiring harness, there were no resistors in series.
Yeah for some reason because it is powered by 5V I assumed the pins could handle 5V. I think maybe they were using the analog pins in the applications I have seen. The analog pins can handle 5V, correct?
That's strange because the chip used is in this product:
I have measured 5 volts off of the encoder. I have opened one up and there are no resistors between the encoder wires and the I/O pins on the board. Is it possible it works but isn't recommended? The reason I bought this particular board is because it is the same one used in another 5V encoder converter.