Is it possible to re-assign EV3 sensor pins from inputs to outputs using something like Arduino's pinMode()? #1823
Replies: 2 comments 3 replies
-
Some sensors use the 9V battery supply on pin 1 or 2 (I forget which one). If the other is connected to ground (I don't remember, but you could look this up) it might be technically possible. It would only be on/off though, so there is no PWM for brightness control. And you would still need a way to activate this sensor mode. If I recall correctly, the Ultrasonic Sensor makes uses of this. To verify, you could attach it and measure the voltage across pins 1/2.
If you did it this way, you'll be able to toggle the light on and off by setting the sensor mode to analog, and toggling between active/passive sensors. |
Beta Was this translation helpful? Give feedback.
-
You can use either Pin 1 to supply battery voltage or Pin 4 to supply 5V to power the LED. Battery voltage would be better if you have lots of LEDs as the 5V supply is shared with other things on the EV3, like USB and the analog inputs. You can use Pin 3 as the ground for both of these. Pin 2 cannot be used as ground. The easiest way to turn the power supply on on pin 1 is to put the port into "other-i2c" mode. Putting it into any other mode will turn the supply off. |
Beta Was this translation helpful? Give feedback.
-
To start: I only want to drive LEDs (not motors) via the sensor ports. Specifically, EV3 -> NXT 9V converter -> Power Functions Extension -> Power Functions Light Cable. While I have seen this question once or twice in other places on the Internet, I am trying to get at something a little more specific.
On motor ports (which I have reserved for actual motors), Pin 1 is positive PWM (+9V?) and Pin 3 is GND, however on sensor ports Pin 1 is mapped to Analog Input and Pin 3 is GND. I have read that pin 1 of Ports 1/2/3/4 of the EV3 are connected to GPIO pins on the processor; is there a way to tell the EV3 brick to use them as voltage outputs instead of analog inputs (either through a built-in function or through the Linux subsystem)? Thinking to other microcontrollers such as Arduino-based systems, pins usually have the capability to perform multiple functions depending on whether you initialize them using
pinMode(A0, INPUT_PULLUP);
for an analog input, orpinMode(A0, OUTPUT); digitalWrite(A0, HIGH);
for a digital output.I suspect what I am attempting is possible, but whether or not 1) the functions/registers for this are exposed to the user, and 2) if the supporting circuitry can provide steady voltage is another question. According to EV3Dev Pin 1 of ports 1/2/3/4 map to the ARM1808 processor pins GPIO 8-10/GPIO 8-12/GPIO 6-4/GPIO 8-9 respectively, and according to page 21 of the Technical Reference Manual from TI all GPIO pins are capable of multiple modes of operation.
If this is not possible, my fallback plan is to splice a custom cable to use Pin 4 (+4.3V) of the sensor pins to provide a constant output to LEDs.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions