Difference between revisions of "Tondaj SL-814"
Uwe Hermann (talk | contribs) m |
Uwe Hermann (talk | contribs) m |
||
Line 207: | Line 207: | ||
b3 f2 02 0d - C, Fast, Level: 100, 101.0 dB | b3 f2 02 0d - C, Fast, Level: 100, 101.0 dB | ||
</small> | </small> | ||
== Resources == | |||
TODO. | |||
[[Category:Device]] | [[Category:Device]] | ||
[[Category:Sound level meter]] | [[Category:Sound level meter]] |
Revision as of 18:23, 2 November 2012
The Tondaj SL-814 is a sound level meter with USB connectivity.
See Tondaj SL-814/Info for more details (such as lsusb -vvv output) about the device.
Hardware
Device:
- Main CPU: Atmel ATmega8/L (marking: "Atmel ATmega8L 8AU 1113D"), (datasheet)
- 8MHz crystal: 8.00ECSXR
- ?: 324 GZ15129
- 5V (100mA) low-dropout voltage regulator: Holtek HT7550-1# (datasheet)
- Trim potentiometer: Bochen 3296
USB cable:
Photos
Device:
USB cable:
See Device_cables#Tondaj_SL-814_cable.
Protocol
The device has a mini-USB connector for PC connectivity. It ships with a Prolific USB-to-serial cable (i.e. the Prolific chip is inside the cable) which can be attached to that connector.
The device accepts a simple command-based protocol over the (virtual) serial port, using a baudrate of 9600 baud, with 8e1 settings (8 data bits, even parity, one stop bit).
Commands / replies
Commands and replies can consist of multiple bytes, and always end with 0x0d.
Name | Command | Reply | Comments |
---|---|---|---|
Init | 0x10 0x04 0x0d | 0x05 0x0d | It's unclear what exactly this command does. Data transfers also seem to work fine when it is omitted. |
Get measurement | 0x30 0xZZ 0x0d | 0xAA 0xBB 0xZZ+1 0x0d | For a given command with 0xZZ value (0-255), the device returns 0xZZ + 1 as part of the reply (a simple "sequence number" mechanism which is apparently meant for the host as error-checking mechanism). |
Data reply
The first two bytes of the reply to the "get measurement" command (0xAA 0xBB) have the following format:
Byte | Bit | Value |
---|---|---|
0 | ||
7 | A/C measurement type. 0: A, 1: C. | |
6 | Unknown/unused. | |
5-4 | Level. 00: 40, 01: 60, 10: 80, 11: 100 | |
3 | Slow/Fast measurement mode. 0: Fast, 1: Slow. | |
2-0 | Value[10..8]. | |
1 | ||
7-0 | Value[7..0]. |
The actual measurement value seems to span 11 bits, and is encoded in BCD format. Example: If Value[10..0] is 436 (decimal), the corresponding measurement value is 43.6 dB.
Notes
The "MAX" mode on the device (which always keeps showing the highest measured value since the "MAX" button was pressed) only affects the value shown on the display. The values returned via USB upon the "get measurement" command, always show the current value, not the "MAX" one shown on the display.
Python script
Here's a quick Python script for getting the values out of the Tondaj SL-814. A sigrok driver will follow soon.
#!/usr/bin/python3 # Tondaj SL-814 sound level meter Python script # Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de> # Released under the terms of the GNU GPL, version 2 or later. import time import serial s = serial.Serial('/dev/ttyUSB0', baudrate=9600, parity=serial.PARITY_EVEN) while 1: # Query s.write(bytes([0x30, 0x01, 0x0d])) result = s.read(4) print('%02x %02x %02x %02x' % tuple(result), end=' - ') # A/C ac = (result[0] & (1 << 7)) >> 7 print('A' if ac == 0 else 'C', end=', ') # Slow/Fast sl = (result[0] & (1 << 3)) >> 3 print('Fast' if sl == 0 else 'Slow', end=', ') # Level factor = (result[0] & ((1 << 5) | (1 << 4))) >> 4 print('Level: %d' % (40 + (int(bin(factor), 2) * 20)), end=', ') # Value val = ((result[0] & 0x7) << 8) | result[1] tmp_str = '%d' % val val_str = tmp_str[:-1] + '.' + tmp_str[-1:] print(val_str + ' dB') time.sleep(0.5) s.close()
Example output:
09 af 02 0d - A, Slow, Level: 40, 43.1 dB 09 b9 02 0d - A, Slow, Level: 40, 44.1 dB 09 e9 02 0d - A, Slow, Level: 40, 48.9 dB 89 cb 02 0d - C, Slow, Level: 40, 45.9 dB 89 eb 02 0d - C, Slow, Level: 40, 49.1 dB 8a 6c 02 0d - C, Slow, Level: 40, 62.0 dB 82 99 02 0d - C, Fast, Level: 40, 66.5 dB 82 3c 02 0d - C, Fast, Level: 40, 57.2 dB 82 72 02 0d - C, Fast, Level: 40, 62.6 dB 92 85 02 0d - C, Fast, Level: 60, 64.5 dB 93 05 02 0d - C, Fast, Level: 60, 77.3 dB 92 68 02 0d - C, Fast, Level: 60, 61.6 dB a3 93 02 0d - C, Fast, Level: 80, 91.5 dB a3 93 02 0d - C, Fast, Level: 80, 91.5 dB a3 93 02 0d - C, Fast, Level: 80, 91.5 dB b3 f2 02 0d - C, Fast, Level: 100, 101.0 dB b3 f2 02 0d - C, Fast, Level: 100, 101.0 dB b3 f2 02 0d - C, Fast, Level: 100, 101.0 dB
Resources
TODO.