I'm using ADXL345 accelerometer with Raspberry Pi to build a seismograph. I've successfully hooked it up and can plot the accelerometer data in three axis. Is there any way to express these data in the form of the magnitude of an earthquake, of course, at the point of sensing? I know that it might be imprecise, but any representation would be helpful (e.g. Richter scale), and how to accomplish that.
The magnitude of an earthquake is related to the total energy released, therefore to estimate it from a seismogram you need to know the distance to the source. In the case of the Richter scale for example, the relationship between magnitude and seismogram amplitude is defined for a standard distance.
But you can estimate the local seismic intensity of the event at the particular location of your instrument. With the accelerometer data you can easily measure the peak ground acceleration, that can be used to estimate the intensity in any of the existing scales. For example, the peak ground accelerations associated to each intensity level in the commonly used Mercalli intensity scale are:
Those g values would be easy to calculate with the accelerometer data and proper calibration constants.
Table taken from the Wikipedia page for peak ground acceleration
You might want to have a look at this question. There are some nice answers and references that you might find useful.