scope.grc 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. options:
  2. parameters:
  3. author: ''
  4. category: '[GRC Hier Blocks]'
  5. cmake_opt: ''
  6. comment: ''
  7. copyright: ''
  8. description: ''
  9. gen_cmake: 'On'
  10. gen_linking: dynamic
  11. generate_options: qt_gui
  12. hier_block_src_path: '.:'
  13. id: scope
  14. max_nouts: '0'
  15. output_language: python
  16. placement: (0,0)
  17. qt_qss_theme: ''
  18. realtime_scheduling: ''
  19. run: 'True'
  20. run_command: '{python} -u {filename}'
  21. run_options: prompt
  22. sizing_mode: fixed
  23. thread_safe_setters: ''
  24. title: Arduino Voltmeter / Oscilloscope
  25. window_size: ''
  26. states:
  27. bus_sink: false
  28. bus_source: false
  29. bus_structure: null
  30. coordinate: [20, 20]
  31. rotation: 0
  32. state: enabled
  33. blocks:
  34. - name: input_voltage_max
  35. id: variable
  36. parameters:
  37. comment: ''
  38. value: reference_voltage * resistor_in_ohm / resistor_ground_ohm + reference_voltage
  39. states:
  40. bus_sink: false
  41. bus_source: false
  42. bus_structure: null
  43. coordinate: [1491, 193]
  44. rotation: 0
  45. state: true
  46. - name: input_voltage_min
  47. id: variable
  48. parameters:
  49. comment: ''
  50. value: -1 * reference_voltage * resistor_in_ohm / resistor_ref_ohm
  51. states:
  52. bus_sink: false
  53. bus_source: false
  54. bus_structure: null
  55. coordinate: [1494, 94]
  56. rotation: 0
  57. state: true
  58. - name: reference_voltage
  59. id: variable
  60. parameters:
  61. comment: ''
  62. value: '4.11'
  63. states:
  64. bus_sink: false
  65. bus_source: false
  66. bus_structure: null
  67. coordinate: [457, 222]
  68. rotation: 0
  69. state: true
  70. - name: resistor_ground_ohm
  71. id: variable
  72. parameters:
  73. comment: ''
  74. value: 10e3
  75. states:
  76. bus_sink: false
  77. bus_source: false
  78. bus_structure: null
  79. coordinate: [892, 124]
  80. rotation: 0
  81. state: true
  82. - name: resistor_in_ohm
  83. id: variable
  84. parameters:
  85. comment: ''
  86. value: 100e3
  87. states:
  88. bus_sink: false
  89. bus_source: false
  90. bus_structure: null
  91. coordinate: [926, 26]
  92. rotation: 0
  93. state: true
  94. - name: resistor_ref_ohm
  95. id: variable
  96. parameters:
  97. comment: ''
  98. value: 10e3
  99. states:
  100. bus_sink: false
  101. bus_source: false
  102. bus_structure: null
  103. coordinate: [925, 222]
  104. rotation: 0
  105. state: true
  106. - name: sample_rate_hz
  107. id: variable
  108. parameters:
  109. comment: ''
  110. value: '1044.4'
  111. states:
  112. bus_sink: false
  113. bus_source: false
  114. bus_structure: null
  115. coordinate: [58, 173]
  116. rotation: 0
  117. state: enabled
  118. - name: blocks_add_const_vxx_0
  119. id: blocks_add_const_vxx
  120. parameters:
  121. affinity: ''
  122. alias: ''
  123. comment: '- V_ref * R_in / R_ref'
  124. const: input_voltage_min
  125. maxoutbuf: '0'
  126. minoutbuf: '0'
  127. type: float
  128. vlen: '1'
  129. states:
  130. bus_sink: false
  131. bus_source: false
  132. bus_structure: null
  133. coordinate: [1116, 324]
  134. rotation: 0
  135. state: enabled
  136. - name: blocks_multiply_const_vxx_0
  137. id: blocks_multiply_const_vxx
  138. parameters:
  139. affinity: ''
  140. alias: ''
  141. comment: (1 + R_in / R_gnd + R_in / R_ref)
  142. const: '1 + resistor_in_ohm / resistor_ground_ohm + resistor_in_ohm / resistor_ref_ohm '
  143. maxoutbuf: '0'
  144. minoutbuf: '0'
  145. type: float
  146. vlen: '1'
  147. states:
  148. bus_sink: false
  149. bus_source: false
  150. bus_structure: null
  151. coordinate: [816, 324]
  152. rotation: 0
  153. state: enabled
  154. - name: blocks_short_to_float_0
  155. id: blocks_short_to_float
  156. parameters:
  157. affinity: ''
  158. alias: ''
  159. comment: ''
  160. maxoutbuf: '0'
  161. minoutbuf: '0'
  162. scale: 1024 / reference_voltage
  163. vlen: '1'
  164. states:
  165. bus_sink: false
  166. bus_source: false
  167. bus_structure: null
  168. coordinate: [483, 324]
  169. rotation: 0
  170. state: true
  171. - name: epy_block_0
  172. id: epy_block
  173. parameters:
  174. _source_code: "import time\n\nimport gnuradio\nimport numpy\nimport serial\n\n\
  175. \nclass ArduinoAnalogReadings(gnuradio.gr.sync_block):\n def __init__(\n\
  176. \ self, port=\"/dev/ttyUSB0\", baud_rate=115200, buffer_max_length=10,\
  177. \ timeout=2\n ):\n gnuradio.gr.sync_block.__init__(\n self,\
  178. \ name=\"Arduino Analog Readings\", in_sig=None, out_sig=[numpy.int16]\n \
  179. \ )\n self._serial_port = serial.Serial(\n port=port,\
  180. \ baudrate=baud_rate, bytesize=serial.EIGHTBITS, timeout=timeout\n )\n\
  181. \ self._buffer_max_length = buffer_max_length\n self._samples_counter\
  182. \ = 0\n self._sample_rate_report_timestamp = None\n\n def work(self,\
  183. \ input_items, output_items):\n # pylint: disable=unused-argument\n \
  184. \ buffer = self._serial_port.read(\n 2 * min(len(output_items[0]),\
  185. \ self._buffer_max_length)\n )\n assert len(buffer) % 2 == 0\n\
  186. \ buffer_samples_count = len(buffer) // 2\n output_items[0][:buffer_samples_count]\
  187. \ = numpy.frombuffer(buffer, dtype=\">u2\")\n assert output_items[0][:buffer_samples_count].max()\
  188. \ < 1024, \"lost sync?\"\n self._samples_counter += buffer_samples_count\n\
  189. \ current_timestamp = time.time()\n if not self._sample_rate_report_timestamp:\n\
  190. \ self._sample_rate_report_timestamp = current_timestamp\n \
  191. \ elif (current_timestamp - self._sample_rate_report_timestamp) > 8:\n \
  192. \ sample_rate_hz = self._samples_counter / (\n current_timestamp\
  193. \ - self._sample_rate_report_timestamp\n )\n print(f\"\
  194. {sample_rate_hz:.01f} Hz\")\n self._samples_counter = 0\n \
  195. \ self._sample_rate_report_timestamp = current_timestamp\n return\
  196. \ buffer_samples_count\n"
  197. affinity: ''
  198. alias: ''
  199. baud_rate: '115200'
  200. buffer_max_length: int(sample_rate_hz/4)
  201. comment: ''
  202. maxoutbuf: '0'
  203. minoutbuf: '0'
  204. port: '''/dev/ttyUSB0'''
  205. timeout: '2'
  206. states:
  207. _io_cache: ('Arduino Analog Readings', 'ArduinoAnalogReadings', [('port', "'/dev/ttyUSB0'"),
  208. ('baud_rate', '115200'), ('buffer_max_length', '10'), ('timeout', '2')], [],
  209. [('0', 'short', 1)], '', [])
  210. bus_sink: false
  211. bus_source: false
  212. bus_structure: null
  213. coordinate: [15, 276]
  214. rotation: 0
  215. state: true
  216. - name: qtgui_freq_sink_x_0
  217. id: qtgui_freq_sink_x
  218. parameters:
  219. affinity: ''
  220. alias: ''
  221. alpha1: '1.0'
  222. alpha10: '1.0'
  223. alpha2: '1.0'
  224. alpha3: '1.0'
  225. alpha4: '1.0'
  226. alpha5: '1.0'
  227. alpha6: '1.0'
  228. alpha7: '1.0'
  229. alpha8: '1.0'
  230. alpha9: '1.0'
  231. autoscale: 'False'
  232. average: '1.0'
  233. axislabels: 'True'
  234. bw: sample_rate_hz
  235. color1: '"blue"'
  236. color10: '"dark blue"'
  237. color2: '"red"'
  238. color3: '"green"'
  239. color4: '"black"'
  240. color5: '"cyan"'
  241. color6: '"magenta"'
  242. color7: '"yellow"'
  243. color8: '"dark red"'
  244. color9: '"dark green"'
  245. comment: ''
  246. ctrlpanel: 'False'
  247. fc: '0'
  248. fftsize: '1024'
  249. freqhalf: 'True'
  250. grid: 'False'
  251. gui_hint: ''
  252. label: Relative Gain
  253. label1: ''
  254. label10: ''''''
  255. label2: ''''''
  256. label3: ''''''
  257. label4: ''''''
  258. label5: ''''''
  259. label6: ''''''
  260. label7: ''''''
  261. label8: ''''''
  262. label9: ''''''
  263. legend: 'False'
  264. maxoutbuf: '0'
  265. minoutbuf: '0'
  266. name: '""'
  267. nconnections: '1'
  268. showports: 'False'
  269. tr_chan: '0'
  270. tr_level: '0.0'
  271. tr_mode: qtgui.TRIG_MODE_FREE
  272. tr_tag: '""'
  273. type: float
  274. units: dB
  275. update_time: '0.10'
  276. width1: '2'
  277. width10: '1'
  278. width2: '1'
  279. width3: '1'
  280. width4: '1'
  281. width5: '1'
  282. width6: '1'
  283. width7: '1'
  284. width8: '1'
  285. width9: '1'
  286. wintype: firdes.WIN_BLACKMAN_hARRIS
  287. ymax: '0'
  288. ymin: '-100'
  289. states:
  290. bus_sink: false
  291. bus_source: false
  292. bus_structure: null
  293. coordinate: [897, 459]
  294. rotation: 0
  295. state: disabled
  296. - name: qtgui_number_sink_0
  297. id: qtgui_number_sink
  298. parameters:
  299. affinity: ''
  300. alias: ''
  301. autoscale: 'False'
  302. avg: '0'
  303. color1: ("black", "black")
  304. color10: ("black", "black")
  305. color2: ("black", "black")
  306. color3: ("black", "black")
  307. color4: ("black", "black")
  308. color5: ("black", "black")
  309. color6: ("black", "black")
  310. color7: ("black", "black")
  311. color8: ("black", "black")
  312. color9: ("black", "black")
  313. comment: ''
  314. factor1: '1'
  315. factor10: '1'
  316. factor2: '1'
  317. factor3: '1'
  318. factor4: '1'
  319. factor5: '1'
  320. factor6: '1'
  321. factor7: '1'
  322. factor8: '1'
  323. factor9: '1'
  324. graph_type: qtgui.NUM_GRAPH_HORIZ
  325. gui_hint: ''
  326. label1: Voltage
  327. label10: ''
  328. label2: ''
  329. label3: ''
  330. label4: ''
  331. label5: ''
  332. label6: ''
  333. label7: ''
  334. label8: ''
  335. label9: ''
  336. max: input_voltage_max
  337. min: input_voltage_min
  338. name: '""'
  339. nconnections: '1'
  340. type: float
  341. unit1: V
  342. unit10: ''
  343. unit2: ''
  344. unit3: ''
  345. unit4: ''
  346. unit5: ''
  347. unit6: ''
  348. unit7: ''
  349. unit8: ''
  350. unit9: ''
  351. update_time: '0.10'
  352. states:
  353. bus_sink: false
  354. bus_source: false
  355. bus_structure: null
  356. coordinate: [1490, 428]
  357. rotation: 0
  358. state: enabled
  359. - name: qtgui_number_sink_0_0
  360. id: qtgui_number_sink
  361. parameters:
  362. affinity: ''
  363. alias: ''
  364. autoscale: 'False'
  365. avg: '0'
  366. color1: ("black", "black")
  367. color10: ("black", "black")
  368. color2: ("black", "black")
  369. color3: ("black", "black")
  370. color4: ("black", "black")
  371. color5: ("black", "black")
  372. color6: ("black", "black")
  373. color7: ("black", "black")
  374. color8: ("black", "black")
  375. color9: ("black", "black")
  376. comment: ''
  377. factor1: '1'
  378. factor10: '1'
  379. factor2: '1'
  380. factor3: '1'
  381. factor4: '1'
  382. factor5: '1'
  383. factor6: '1'
  384. factor7: '1'
  385. factor8: '1'
  386. factor9: '1'
  387. graph_type: qtgui.NUM_GRAPH_HORIZ
  388. gui_hint: ''
  389. label1: ''
  390. label10: ''
  391. label2: ''
  392. label3: ''
  393. label4: ''
  394. label5: ''
  395. label6: ''
  396. label7: ''
  397. label8: ''
  398. label9: ''
  399. max: '1024'
  400. min: '0'
  401. name: '"Arduino Reading"'
  402. nconnections: '1'
  403. type: short
  404. unit1: ''
  405. unit10: ''
  406. unit2: ''
  407. unit3: ''
  408. unit4: ''
  409. unit5: ''
  410. unit6: ''
  411. unit7: ''
  412. unit8: ''
  413. unit9: ''
  414. update_time: '0.10'
  415. states:
  416. bus_sink: false
  417. bus_source: false
  418. bus_structure: null
  419. coordinate: [452, 499]
  420. rotation: 0
  421. state: disabled
  422. - name: qtgui_time_sink_x_0
  423. id: qtgui_time_sink_x
  424. parameters:
  425. affinity: ''
  426. alias: ''
  427. alpha1: '1.0'
  428. alpha10: '1.0'
  429. alpha2: '1.0'
  430. alpha3: '1.0'
  431. alpha4: '1.0'
  432. alpha5: '1.0'
  433. alpha6: '1.0'
  434. alpha7: '1.0'
  435. alpha8: '1.0'
  436. alpha9: '1.0'
  437. autoscale: 'False'
  438. axislabels: 'True'
  439. color1: blue
  440. color10: dark blue
  441. color2: red
  442. color3: green
  443. color4: black
  444. color5: cyan
  445. color6: magenta
  446. color7: yellow
  447. color8: dark red
  448. color9: dark green
  449. comment: ''
  450. ctrlpanel: 'False'
  451. entags: 'True'
  452. grid: 'False'
  453. gui_hint: ''
  454. label1: Signal 1
  455. label10: Signal 10
  456. label2: Signal 2
  457. label3: Signal 3
  458. label4: Signal 4
  459. label5: Signal 5
  460. label6: Signal 6
  461. label7: Signal 7
  462. label8: Signal 8
  463. label9: Signal 9
  464. legend: 'False'
  465. marker1: '-1'
  466. marker10: '-1'
  467. marker2: '-1'
  468. marker3: '-1'
  469. marker4: '-1'
  470. marker5: '-1'
  471. marker6: '-1'
  472. marker7: '-1'
  473. marker8: '-1'
  474. marker9: '-1'
  475. name: '""'
  476. nconnections: '1'
  477. size: int(sample_rate_hz*2)
  478. srate: sample_rate_hz
  479. stemplot: 'False'
  480. style1: '1'
  481. style10: '1'
  482. style2: '1'
  483. style3: '1'
  484. style4: '1'
  485. style5: '1'
  486. style6: '1'
  487. style7: '1'
  488. style8: '1'
  489. style9: '1'
  490. tr_chan: '0'
  491. tr_delay: '0'
  492. tr_level: '0.0'
  493. tr_mode: qtgui.TRIG_MODE_FREE
  494. tr_slope: qtgui.TRIG_SLOPE_POS
  495. tr_tag: '""'
  496. type: float
  497. update_time: '0.10'
  498. width1: '2'
  499. width10: '1'
  500. width2: '1'
  501. width3: '1'
  502. width4: '1'
  503. width5: '1'
  504. width6: '1'
  505. width7: '1'
  506. width8: '1'
  507. width9: '1'
  508. ylabel: Voltage
  509. ymax: input_voltage_max
  510. ymin: input_voltage_min
  511. yunit: '"V"'
  512. states:
  513. bus_sink: false
  514. bus_source: false
  515. bus_structure: null
  516. coordinate: [1462, 292]
  517. rotation: 0
  518. state: enabled
  519. - name: qtgui_time_sink_x_0_0
  520. id: qtgui_time_sink_x
  521. parameters:
  522. affinity: ''
  523. alias: ''
  524. alpha1: '1.0'
  525. alpha10: '1.0'
  526. alpha2: '1.0'
  527. alpha3: '1.0'
  528. alpha4: '1.0'
  529. alpha5: '1.0'
  530. alpha6: '1.0'
  531. alpha7: '1.0'
  532. alpha8: '1.0'
  533. alpha9: '1.0'
  534. autoscale: 'False'
  535. axislabels: 'True'
  536. color1: blue
  537. color10: dark blue
  538. color2: red
  539. color3: green
  540. color4: black
  541. color5: cyan
  542. color6: magenta
  543. color7: yellow
  544. color8: dark red
  545. color9: dark green
  546. comment: ''
  547. ctrlpanel: 'False'
  548. entags: 'True'
  549. grid: 'False'
  550. gui_hint: ''
  551. label1: Signal 1
  552. label10: Signal 10
  553. label2: Signal 2
  554. label3: Signal 3
  555. label4: Signal 4
  556. label5: Signal 5
  557. label6: Signal 6
  558. label7: Signal 7
  559. label8: Signal 8
  560. label9: Signal 9
  561. legend: 'False'
  562. marker1: '-1'
  563. marker10: '-1'
  564. marker2: '-1'
  565. marker3: '-1'
  566. marker4: '-1'
  567. marker5: '-1'
  568. marker6: '-1'
  569. marker7: '-1'
  570. marker8: '-1'
  571. marker9: '-1'
  572. name: '""'
  573. nconnections: '1'
  574. size: int(sample_rate_hz*2)
  575. srate: sample_rate_hz
  576. stemplot: 'False'
  577. style1: '1'
  578. style10: '1'
  579. style2: '1'
  580. style3: '1'
  581. style4: '1'
  582. style5: '1'
  583. style6: '1'
  584. style7: '1'
  585. style8: '1'
  586. style9: '1'
  587. tr_chan: '0'
  588. tr_delay: '0'
  589. tr_level: '0.0'
  590. tr_mode: qtgui.TRIG_MODE_FREE
  591. tr_slope: qtgui.TRIG_SLOPE_POS
  592. tr_tag: '""'
  593. type: float
  594. update_time: '0.10'
  595. width1: '2'
  596. width10: '1'
  597. width2: '1'
  598. width3: '1'
  599. width4: '1'
  600. width5: '1'
  601. width6: '1'
  602. width7: '1'
  603. width8: '1'
  604. width9: '1'
  605. ylabel: Arduino Input Voltage
  606. ymax: reference_voltage
  607. ymin: '0'
  608. yunit: '"V"'
  609. states:
  610. bus_sink: false
  611. bus_source: false
  612. bus_structure: null
  613. coordinate: [896, 636]
  614. rotation: 0
  615. state: disabled
  616. connections:
  617. - [blocks_add_const_vxx_0, '0', qtgui_number_sink_0, '0']
  618. - [blocks_add_const_vxx_0, '0', qtgui_time_sink_x_0, '0']
  619. - [blocks_multiply_const_vxx_0, '0', blocks_add_const_vxx_0, '0']
  620. - [blocks_short_to_float_0, '0', blocks_multiply_const_vxx_0, '0']
  621. - [blocks_short_to_float_0, '0', qtgui_freq_sink_x_0, '0']
  622. - [blocks_short_to_float_0, '0', qtgui_time_sink_x_0_0, '0']
  623. - [epy_block_0, '0', blocks_short_to_float_0, '0']
  624. - [epy_block_0, '0', qtgui_number_sink_0_0, '0']
  625. metadata:
  626. file_format: 1