How can I get the PSI measurement, in order to start/stop the compressor?
iirc the typical pneumatic parts don’t include a precise sensor to measure the PSI, but the pressure switch you are required to use is just a switch which is normally closed and once the system reaches the target PSI of 120 it opens, which the PCM then sees that the system is fully pressurized and cuts power to the compressor.
Just as Ben said, the PCM will handle this for you. It reads the value of the sensor and automatically will turn the compressor on and off.
See these help documents for more information:
https://wpilib.screenstepslive.com/s/currentCS/m/java/l/219351-pneumatics-control-module
The other replies cover starting / stopping the compressor, if you do actually want to get PSI data you can use an analog pressure sensor. They can be nice for helping to make your own decisions about when you want the compressor running or not.
So what can I do in order to get the precise measure? I also need to show it in the smartDashboard.
Be aware that if you do decide to go this route you are still required to have the pressure switch connected to the PCM and on the high pressure side of your pneumatics system, the pressure switch much have final control over the compressor above your analog sensor.
For all recent competition years, you do remember correctly.
Time will tell what 2019 holds for us, though I’d be surprised if there is a change.
(Java assumption incoming) Note there are a few API’s available for disabling the compressor (to save battery or something like that), read compressor current or faults, etc. However, for safety reasons, the cycling of the compressor in normal operation to prevent over-pressurizing the system is automatically done on the PCM, not as part of user code.
I bought one of these for 3946’s air cannon this summer; worked great! If you need to monitor above 100psi, there is also a 150psi version (and others higher and lower). We used it with an Arduino analog input, but no reason it shouldn’t work well with the RIO, or even an analog input to a Talon SRX. As noted above, this cannot be the only cutoff for your compressor; you need the pressure switch as the safety fallback. You CAN use this to shut off the compressor earlier (e.g. at 90 psi) if you wish, or to determine if you have enough pressure to execute a task, e.g. at endgame.