I’ve am running RealDash on Raspberry Pi, running on Android.
I’ve got a wit-motion.com accelerometer, which, from what I understand, communicates via Serial (it has 4 cables, vcc, gnd, txd, rxd). Is there a way already, where I can add such device as data source?
You are suggesting getting the numbers and sending them as analog numbers in the CAN data, right? Is there any specific format I should send? XYZ altogether or separately? The goal is to have the G-Map on Lexus-inspired dash to work.
You can send any data to RealDash with RealDash CAN protocol. For Accelerometer, send X, Y and Z acceleration (in G) to inputs 6, 7, and 8. See complete list:
I’ve managed to read data and send it via Serial CAN, but however, the numbers are read as Integers. Whenever G is not 0, its read as 1. what am I doing wrong?
as mentioned earlier, I’ve managed to send data from my sensor to RD via RDCAN, however, the data I have is apparently Acceleration RAW. What is the difference between Raw and G data? How to convert RAW to G?
Raw accelerometer values have a constant 1G pointing to (about) center of the earth. So if device is not moving at all, the length of X,Y and Z components of raw data is close to 1.0.
G data is derived from this by using math to remove the 1G from the data to get current acceleration along the the axis.
With your seed and little help from GPT, I have managed to convert the data and send it to targets of 6, 7, and 8.
1. Convert Raw Values to g Values : Typically, raw values from an accelerometer are in ADC units. The datasheet or manual of your accelerometer will provide details on converting these to ‘g’ units. However, I’ll assume in this example that your accelerometer already provides readings in ‘g’ units.
2. Calculate Magnitude of the Acceleration : To determine the amount of static gravitational force on the accelerometer, you can calculate the magnitude of the total acceleration vector:
magnitude = sqrt(x^2 + y^2 + z^2)
3. Normalize the Acceleration Vector : This will give you the direction of the gravitational force:
x_norm = x / magnitude; y_norm = y / magnitude; z_norm = z / magnitude;
4. Remove Gravity : Subtract the normalized gravity vector scaled by 1g from the original readings:
x_dynamic = x - x_norm * 1g; y_dynamic = y - y_norm * 1g; z_dynamic = z - z_norm * 1g
The rest is to send the numbers via RealDashCAN with the right CAN Description file