Archibald: why does the accelerometer be near the pivot? Doesn't it have the smallest (and thus worst measurable) acceleration at this point? That's why I suggested the gyroscope, which measures the angle.
You can think of one axis of an accelerometer as being like a weight sliding on a track with springs attached between the weight and each end of the track. If the track starts off level, you will get a certain reading from the accelerometer but if you then tilt the track the weight will slide and the reading will change. So an accelerometer will measure tilt. If you place your weight, track and springs in a vehicle oriented parallel to the direction of motion, when you accelerate along a level road, the weight will move and the reading from your accelerometer will change. So an accelerometer measures both tilt and acceleration. In other words an accelerometer measures gravitation acceleration at the same time as measuring motion acceleration.
To measure a railway barrier it would be best to use two of the three axes. One axis will work well to determine when the barrier is horizontal, another axis will work well to determine when the barrier is vertical.
Let's consider sticking the accelerometer on the barrier arm furthest away from the pivot and lets consider the barrier to be initially in the closed position to allow a train to pass. You could get your Arduino to monitor the vertical axis of the accelerometer so when the barrier lifts, the reading will gradually get close to the reading you get when the accelerometer axis becomes horizontal, indicating the barrier has become vertical.
The snag is that the end of the barrier will decelerate when it reaches vertical and is quite likely to bounce a little. This deceleration will affect the reading so you won't know when the barrier is exactly vertical. You would eliminate that trouble if you mount your accelerometer over the axis of the pivot (ideally). Alternatively it may be possible to use the readings from your accelerometer to detect the deceleration, perhaps by detecting a relatively sudden change in the readings from your accelerometer. If your barrier moves at constant angular velocity, the reading due to the tilt will change in a cosine relationship, so in theory you could detect the deceleration when the barrier reaches vertical by detecting when the reading deviates from a cosine curve. The coding for that would not be simple. Anyway it's quite likely the barrier motor drive will be designed to decelerate just before it reaches vertical so detecting deceleration is probably not a good way to detect when the barrier has reached vertical. So I recommend sticking your accelerometer as close as possible to the pivot so you only measure the tilt. You will need to consider what happens to your measurement if the barrier does not quite reach vertical; so it may be better to detect when the change in tilt ceases rather than detecting when your accelerometer axis becomes precisely level.
I am not so familiar with gyros but my understanding is that they respond to angular velocity, in practice mostly to changes in angular velocity, not to the angle with respect to gravity. So a gyro could, at least in theory, be used to detect the initial angular acceleration of your barrier and the angular deceleration when it becomes vertical.
At constant speed, there will be no acceleration...so that is out.
An accelerometer will measure tilt.