scope.grc 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  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: [26, 23]
  31. rotation: 0
  32. state: enabled
  33. blocks:
  34. - name: reference_voltage
  35. id: variable
  36. parameters:
  37. comment: ''
  38. value: '4.11'
  39. states:
  40. bus_sink: false
  41. bus_source: false
  42. bus_structure: null
  43. coordinate: [439, 210]
  44. rotation: 0
  45. state: true
  46. - name: resistor_1_ohm
  47. id: variable
  48. parameters:
  49. comment: ''
  50. value: 45.1e3
  51. states:
  52. bus_sink: false
  53. bus_source: false
  54. bus_structure: null
  55. coordinate: [813, 29]
  56. rotation: 0
  57. state: true
  58. - name: resistor_2_ohm
  59. id: variable
  60. parameters:
  61. comment: ''
  62. value: 10.2e3
  63. states:
  64. bus_sink: false
  65. bus_source: false
  66. bus_structure: null
  67. coordinate: [811, 128]
  68. rotation: 0
  69. state: true
  70. - name: sample_rate_hz
  71. id: variable
  72. parameters:
  73. comment: ''
  74. value: 1e6 / 1000
  75. states:
  76. bus_sink: false
  77. bus_source: false
  78. bus_structure: null
  79. coordinate: [67, 172]
  80. rotation: 0
  81. state: enabled
  82. - name: voltage_factor
  83. id: variable
  84. parameters:
  85. comment: ''
  86. value: (resistor_1_ohm + resistor_2_ohm) / resistor_2_ohm * 1.1092365543363658
  87. states:
  88. bus_sink: false
  89. bus_source: false
  90. bus_structure: null
  91. coordinate: [816, 227]
  92. rotation: 0
  93. state: true
  94. - name: blocks_multiply_const_vxx_0
  95. id: blocks_multiply_const_vxx
  96. parameters:
  97. affinity: ''
  98. alias: ''
  99. comment: ''
  100. const: voltage_factor
  101. maxoutbuf: '0'
  102. minoutbuf: '0'
  103. type: float
  104. vlen: '1'
  105. states:
  106. bus_sink: false
  107. bus_source: false
  108. bus_structure: null
  109. coordinate: [811, 324]
  110. rotation: 0
  111. state: true
  112. - name: blocks_short_to_float_0
  113. id: blocks_short_to_float
  114. parameters:
  115. affinity: ''
  116. alias: ''
  117. comment: ''
  118. maxoutbuf: '0'
  119. minoutbuf: '0'
  120. scale: 1024 / reference_voltage
  121. vlen: '1'
  122. states:
  123. bus_sink: false
  124. bus_source: false
  125. bus_structure: null
  126. coordinate: [472, 324]
  127. rotation: 0
  128. state: true
  129. - name: epy_block_0
  130. id: epy_block
  131. parameters:
  132. _source_code: "import time\n\nimport gnuradio\nimport numpy\nimport serial\n\n\
  133. \nclass ArduinoAnalogReadings(gnuradio.gr.sync_block):\n def __init__(\n\
  134. \ self, port=\"/dev/ttyUSB0\", baud_rate=115200, buffer_max_length=10,\
  135. \ timeout=2\n ):\n gnuradio.gr.sync_block.__init__(\n self,\
  136. \ name=\"Arduino Analog Readings\", in_sig=None, out_sig=[numpy.int16]\n \
  137. \ )\n self._serial_port = serial.Serial(\n port=port,\
  138. \ baudrate=baud_rate, bytesize=serial.EIGHTBITS, timeout=timeout\n )\n\
  139. \ self._buffer_max_length = buffer_max_length\n self._samples_counter\
  140. \ = 0\n self._sample_rate_report_timestamp = None\n\n def work(self,\
  141. \ input_items, output_items):\n # pylint: disable=unused-argument\n \
  142. \ buffer = self._serial_port.read(\n 2 * min(len(output_items[0]),\
  143. \ self._buffer_max_length)\n )\n assert len(buffer) % 2 == 0\n\
  144. \ buffer_samples_count = len(buffer) // 2\n output_items[0][:buffer_samples_count]\
  145. \ = numpy.frombuffer(buffer, dtype=\">u2\")\n self._samples_counter +=\
  146. \ buffer_samples_count\n current_timestamp = time.time()\n if\
  147. \ not self._sample_rate_report_timestamp:\n self._sample_rate_report_timestamp\
  148. \ = current_timestamp\n elif (current_timestamp - self._sample_rate_report_timestamp)\
  149. \ > 8:\n sample_rate_hz = self._samples_counter / (\n \
  150. \ current_timestamp - self._sample_rate_report_timestamp\n )\n\
  151. \ print(f\"{sample_rate_hz:.01f} Hz\")\n self._samples_counter\
  152. \ = 0\n self._sample_rate_report_timestamp = current_timestamp\n\
  153. \ return buffer_samples_count\n"
  154. affinity: ''
  155. alias: ''
  156. baud_rate: '115200'
  157. buffer_max_length: int(sample_rate_hz)
  158. comment: ''
  159. maxoutbuf: '0'
  160. minoutbuf: '0'
  161. port: '''/dev/ttyUSB0'''
  162. timeout: '2'
  163. states:
  164. _io_cache: ('Arduino Analog Readings', 'ArduinoAnalogReadings', [('port', "'/dev/ttyUSB0'"),
  165. ('baud_rate', '115200'), ('buffer_max_length', '10'), ('timeout', '2')], [],
  166. [('0', 'short', 1)], '', [])
  167. bus_sink: false
  168. bus_source: false
  169. bus_structure: null
  170. coordinate: [32, 276]
  171. rotation: 0
  172. state: true
  173. - name: qtgui_freq_sink_x_0
  174. id: qtgui_freq_sink_x
  175. parameters:
  176. affinity: ''
  177. alias: ''
  178. alpha1: '1.0'
  179. alpha10: '1.0'
  180. alpha2: '1.0'
  181. alpha3: '1.0'
  182. alpha4: '1.0'
  183. alpha5: '1.0'
  184. alpha6: '1.0'
  185. alpha7: '1.0'
  186. alpha8: '1.0'
  187. alpha9: '1.0'
  188. autoscale: 'False'
  189. average: '1.0'
  190. axislabels: 'True'
  191. bw: sample_rate_hz
  192. color1: '"blue"'
  193. color10: '"dark blue"'
  194. color2: '"red"'
  195. color3: '"green"'
  196. color4: '"black"'
  197. color5: '"cyan"'
  198. color6: '"magenta"'
  199. color7: '"yellow"'
  200. color8: '"dark red"'
  201. color9: '"dark green"'
  202. comment: ''
  203. ctrlpanel: 'False'
  204. fc: '0'
  205. fftsize: '1024'
  206. freqhalf: 'True'
  207. grid: 'False'
  208. gui_hint: ''
  209. label: Relative Gain
  210. label1: ''
  211. label10: ''''''
  212. label2: ''''''
  213. label3: ''''''
  214. label4: ''''''
  215. label5: ''''''
  216. label6: ''''''
  217. label7: ''''''
  218. label8: ''''''
  219. label9: ''''''
  220. legend: 'False'
  221. maxoutbuf: '0'
  222. minoutbuf: '0'
  223. name: '""'
  224. nconnections: '1'
  225. showports: 'False'
  226. tr_chan: '0'
  227. tr_level: '0.0'
  228. tr_mode: qtgui.TRIG_MODE_FREE
  229. tr_tag: '""'
  230. type: float
  231. units: dB
  232. update_time: '0.10'
  233. width1: '2'
  234. width10: '1'
  235. width2: '1'
  236. width3: '1'
  237. width4: '1'
  238. width5: '1'
  239. width6: '1'
  240. width7: '1'
  241. width8: '1'
  242. width9: '1'
  243. wintype: firdes.WIN_BLACKMAN_hARRIS
  244. ymax: '0'
  245. ymin: '-100'
  246. states:
  247. bus_sink: false
  248. bus_source: false
  249. bus_structure: null
  250. coordinate: [822, 442]
  251. rotation: 0
  252. state: true
  253. - name: qtgui_number_sink_0
  254. id: qtgui_number_sink
  255. parameters:
  256. affinity: ''
  257. alias: ''
  258. autoscale: 'False'
  259. avg: '0'
  260. color1: ("black", "black")
  261. color10: ("black", "black")
  262. color2: ("black", "black")
  263. color3: ("black", "black")
  264. color4: ("black", "black")
  265. color5: ("black", "black")
  266. color6: ("black", "black")
  267. color7: ("black", "black")
  268. color8: ("black", "black")
  269. color9: ("black", "black")
  270. comment: ''
  271. factor1: '1'
  272. factor10: '1'
  273. factor2: '1'
  274. factor3: '1'
  275. factor4: '1'
  276. factor5: '1'
  277. factor6: '1'
  278. factor7: '1'
  279. factor8: '1'
  280. factor9: '1'
  281. graph_type: qtgui.NUM_GRAPH_HORIZ
  282. gui_hint: ''
  283. label1: Voltage
  284. label10: ''
  285. label2: ''
  286. label3: ''
  287. label4: ''
  288. label5: ''
  289. label6: ''
  290. label7: ''
  291. label8: ''
  292. label9: ''
  293. max: reference_voltage*voltage_factor
  294. min: '0'
  295. name: '""'
  296. nconnections: '1'
  297. type: float
  298. unit1: V
  299. unit10: ''
  300. unit2: ''
  301. unit3: ''
  302. unit4: ''
  303. unit5: ''
  304. unit6: ''
  305. unit7: ''
  306. unit8: ''
  307. unit9: ''
  308. update_time: '0.10'
  309. states:
  310. bus_sink: false
  311. bus_source: false
  312. bus_structure: null
  313. coordinate: [1155, 291]
  314. rotation: 0
  315. state: true
  316. - name: qtgui_time_sink_x_0
  317. id: qtgui_time_sink_x
  318. parameters:
  319. affinity: ''
  320. alias: ''
  321. alpha1: '1.0'
  322. alpha10: '1.0'
  323. alpha2: '1.0'
  324. alpha3: '1.0'
  325. alpha4: '1.0'
  326. alpha5: '1.0'
  327. alpha6: '1.0'
  328. alpha7: '1.0'
  329. alpha8: '1.0'
  330. alpha9: '1.0'
  331. autoscale: 'False'
  332. axislabels: 'True'
  333. color1: blue
  334. color10: dark blue
  335. color2: red
  336. color3: green
  337. color4: black
  338. color5: cyan
  339. color6: magenta
  340. color7: yellow
  341. color8: dark red
  342. color9: dark green
  343. comment: ''
  344. ctrlpanel: 'False'
  345. entags: 'True'
  346. grid: 'False'
  347. gui_hint: ''
  348. label1: Signal 1
  349. label10: Signal 10
  350. label2: Signal 2
  351. label3: Signal 3
  352. label4: Signal 4
  353. label5: Signal 5
  354. label6: Signal 6
  355. label7: Signal 7
  356. label8: Signal 8
  357. label9: Signal 9
  358. legend: 'False'
  359. marker1: '-1'
  360. marker10: '-1'
  361. marker2: '-1'
  362. marker3: '-1'
  363. marker4: '-1'
  364. marker5: '-1'
  365. marker6: '-1'
  366. marker7: '-1'
  367. marker8: '-1'
  368. marker9: '-1'
  369. name: '""'
  370. nconnections: '1'
  371. size: int(sample_rate_hz*2)
  372. srate: sample_rate_hz
  373. stemplot: 'False'
  374. style1: '1'
  375. style10: '1'
  376. style2: '1'
  377. style3: '1'
  378. style4: '1'
  379. style5: '1'
  380. style6: '1'
  381. style7: '1'
  382. style8: '1'
  383. style9: '1'
  384. tr_chan: '0'
  385. tr_delay: '0'
  386. tr_level: '0.0'
  387. tr_mode: qtgui.TRIG_MODE_FREE
  388. tr_slope: qtgui.TRIG_SLOPE_POS
  389. tr_tag: '""'
  390. type: float
  391. update_time: '0.10'
  392. width1: '2'
  393. width10: '1'
  394. width2: '1'
  395. width3: '1'
  396. width4: '1'
  397. width5: '1'
  398. width6: '1'
  399. width7: '1'
  400. width8: '1'
  401. width9: '1'
  402. ylabel: Voltage
  403. ymax: reference_voltage*voltage_factor
  404. ymin: '0'
  405. yunit: '"V"'
  406. states:
  407. bus_sink: false
  408. bus_source: false
  409. bus_structure: null
  410. coordinate: [1159, 138]
  411. rotation: 0
  412. state: true
  413. connections:
  414. - [blocks_multiply_const_vxx_0, '0', qtgui_number_sink_0, '0']
  415. - [blocks_multiply_const_vxx_0, '0', qtgui_time_sink_x_0, '0']
  416. - [blocks_short_to_float_0, '0', blocks_multiply_const_vxx_0, '0']
  417. - [blocks_short_to_float_0, '0', qtgui_freq_sink_x_0, '0']
  418. - [epy_block_0, '0', blocks_short_to_float_0, '0']
  419. metadata:
  420. file_format: 1