|
Fórum » Alacsony költségű digitális oszcilloszkóp
Egyelőre én nem tettem ilyen magasra a mércét. Ezzel a projektel így is pokolian sok a munka. Úgy gondolom hogy két féle mintavétel lesz. Egy 32KB-os adattal (egyszeri). És egy másik egy képernyőnyi adatmennyiséggel folyamatosan.
Valószínűleg ha minden rendben lesz, akkor majd fejlesztem tovább.
Kitartást!
Kösz!
Szia!
Megjelenítőként egyértelműen használható. A Raspberry PI hardveres képességeit nem ismerem, bár nekem is van egy. (3B-s)
A Raspberry ilyen fajta használatáról még nem hallottam. Nyilván több hónapos fejlesztést igényel feltételezve az elektronikában és programozásban való jártasságot.
Közben töröltem mert találtam pár fórumot,ahol az fpga kisebb késleltetését írták.
Én mondjuk valami SPI analóg digitális átalakítóra gondoltam, bár nem tudom milyen sebességet, mintavételezést tudna.
tutijo felhasználó által megosztott szkóp doksik megvannak valakinek?
Már nem él a link.
Csak olvasgatni, nézegetni szeretném, mi hogyan van.
Köszönöm!
Melyikre gondolsz? Volt neki tobb is.
Hú azt nem tudom, innét lapoztam visszafelé. Miben voltak különbségek?
Köszi
Van egy szkóp, amit ketten csináltunk. Az komplett műszer, dobozban. 2x100 Msa/s, 320x240 LCD, gombok, stb. És csinált Feri egyedül is valami hasonló cuccot, az is FPGA alapú dolog volt, de az nem kész berendezés, csak egy panel.
Mennyire nyílt a dokumentáció róla? Az elsőről amit linkeltél.
Kapcsolasi rajz, forráskódok, egyebek?
Csak saját célra, és szerintem csak érdekességként mert nem hiszem hogy megtudnám csinálni.
Köszönöm
Nem titkos, egy idoben kint is volt a neten, csak szolgaltatovaltas miatt lekerult. Most hirtelen nem tudom megcsinalni, de felteszem ide a kapcsolási rajzot.
Felteszem ide a az FPGA forrást is.
Dicséretes munka összességében! Nem sok hazai próbálkozásról tudok, ami eljutott ilyen szintig legalább...
Mekkora lett az eredő analóg sávszélesség a max bemeneti érzékenységnél ezekkel az IC-kkel?
Szia! Köszi. A sávszélességet nem tudom, sosem mértük.
Ilyenre is át lehetne rakni? Minap találtam a panelek között, meg vannak Cyclone 3 FPGAim.
És ezt át tudod forrasztani úgy hogy jó is legyen, és páciens is túlélje????
Manapság mindent meg lehet oldani, több ismerősöm is foglalkozik bga forrasztással
Megvásároltam a Hantek DSO2D10 oszcilloszkópot, szerintem a 72000Ft-ot nagyon megérte. Van rajta még jelgenerátor is.
Így már nem gondolkodok építésben sem.
6 éve építettem egy digitális szkópot:
A méregdrága Microchip demó kijelzője tönkrement, nem tudtam pótolni, Most elővettem az analóg panelt és egy raspberry pi -re írtam egy python kódot a Tkinter felhasználásával. A Microchip kijelzője a 320x480 képet kb 10fps-sel tudta frissíteni addig a tkinter csak 1 azaz 1 fps-sel, meg kell rajzolni 400x256 képpontot kell összekötni vonallá 2x a két csatornára, majd újra rajzolni feketével hogy az előző ne látszódjon majd újra rajzolni a hátteret, nem kevés.
Milyen olcsó hardwer vagy program raspberry-re lenne jó ami nagyon gyorsan tud rajzolni?
Készítettem egy szkóp demót javascripttel ez nagyon gyors de nem tudom hogyan tudnám beletolni az adatokat, pedig jó lenne mert egy telefon is lehetne a képernyő:
Bővebben: Javascript szkóp demó
Lassú kommunikációs lehetőségeknél más megjelenítési módot kell használni!
Pl, kirajzolod a két csatorna vonalait, ez még azért elég gyors művelet..., majd a teljes képernyő törlése helyett újrarajzolod ugyanezt, de háttér színű vonalakkal! Ekkor eltűnik a régi ábra, mintha csak törlést végeztél volna, csak jóval gyorsabban végezve vele! Innentől rajzolhatod a normál csatorna színekkel az új adatokat... Nagyvonalakban ennyi.
Nem törlöm a teljes képernyőt ennyire kezdő nem vagyok. Úgy van ahogy leirtad.
Canvas.create_line(x1, y1, x2, y2, fill="green")
Így rajzol a Tkinter vonalat, a javascript így:
ctx.beginPath();
ctx.moveTo(0,0);
for(var i= 0; i<480; i++){
ctx.lineTo(i,256-y[i]);
}
ctx.strokeStyle = '#00FF20';
ctx.stroke();
Az utolsó sorra jelenik meg az ábra, A hozzászólás módosítva: Dec 25, 2021
Tudom hogy lehet pythonnal gyorsan rajzolni, pl a cura is azzal van megírva, ez egy gkód konvertáló 3d nyomtatóhoz, a 3d modelleket nagyon szépen lehet vele forgatni, az WX nevű GUI-t használ nem Tkintert
Megmutatom a programot, a fifo ram-okból kiolvasom az adatokat mikor megtelt 1024 byte adat, majd az első 540 adatban keresek egy trigger pontot ahonnan ki tudom rajzolni a képernyő 480 oszlopát.
from tkinter import *
import tkinter as tk
import time
import serial
import RPi.GPIO as gpio
import os
import rom
import math
import numpy as np
import datetime
gpio.setwarnings(False)
gpio.cleanup
gpio.setmode(gpio.BCM)
gpio.setup(17, gpio.OUT)
gpio.setup(27, gpio.OUT)
gpio.setup(22, gpio.OUT)
gpio.setup(5, gpio.IN,pull_up_down=gpio.PUD_DOWN)
gpio.setup(6, gpio.IN,pull_up_down=gpio.PUD_DOWN)
gpio.setup(13, gpio.IN,pull_up_down=gpio.PUD_DOWN)
gpio.setup(19, gpio.IN,pull_up_down=gpio.PUD_DOWN)
gpio.setup(26, gpio.IN,pull_up_down=gpio.PUD_DOWN)
gpio.output(17, gpio.HIGH)
gpio.output(27, gpio.HIGH)
gpio.output(22, gpio.LOW)
time.1)
ser = serial.Serial(
port='/dev/ttyAMA0', #Replace ttyS0 with ttyAM0 for Pi1,Pi2,Pi0ttyAMA0
baudrate = 115200,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
ser.close()
ser.open()
if ser.isOpen():
print ('Open: ' + ser.portstr)
values0 = bytearray([254,1,0,255])
ser.write(values0)
time.0.1)
values1 = bytearray([254,2,0,255])
ser.write(values1)
time.0.1)
values1b = bytearray([254,3,0,255])
ser.write(values1b)
time.0.1)
values2 = bytearray([254,6,116,255])
ser.write(values2)
time.0.1)
values2b = bytearray([254,7,116,255])
ser.write(values2b)
time.0.1)
values3 = bytearray([254,4,0,255])
ser.write(values3)
time.0.1)
values3b = bytearray([254,5,0,255])
ser.write(values3b)
time.0.1)
ch1 = np.array([0,0,0,0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,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
sat = np.array([0])
trigch = np.array([0])
def sel():
xt = xtv.get()
xts = bytearray([254,1,xt,255])
ser.write(xts)
def sel1():
g1 = g1v.get()
g1s= bytearray([254,2,g1,255])
ser.write(g1s)
def sel2():
g2 = g2v.get()
g2s= bytearray([254,3,g2,255])
ser.write(g2s)
def sel3():
g3 = g3v.get()
g3s= bytearray([254,4,g3,255])
ser.write(g3s)
def sel4():
g4 = g4v.get()
g4s= bytearray([254,5,g4,255])
ser.write(g4s)
def sel5():
g5 = g5v.get()
trigch[0]=g5
win=Tk()
win.title("DSO")
f = tk.Frame(win, width=640, height=40, borderwidth=10, relief=FLAT)
canvas=tk.Canvas(win, width=400, height=260, bg = "black")
canvas.grid(row=0,column=1, rowspan = 10)
xtv = IntVar()
g1v = IntVar()
g2v = IntVar()
g3v = IntVar()
g4v = IntVar()
g5v = IntVar()
R1=Radiobutton(win, text = "50ms", variable = xtv, value = 0, comm = sel).grid(row=0,column=0, sticky="w")
R2=Radiobutton(win, text = "25ms", variable = xtv, value = 1, comm = sel).grid(row=1,column=0, sticky="w")
R3=Radiobutton(win, text = "10ms", variable = xtv, value = 2, comm = sel).grid(row=2,column=0, sticky="w")
R4=Radiobutton(win, text = "5ms", variable = xtv, value = 3, comm = sel).grid(row=3,column=0, sticky="w")
R5=Radiobutton(win, text = "2,5ms", variable = xtv, value = 4, comm = sel).grid(row=4,column=0, sticky="w")
R6=Radiobutton(win, text = "1ms", variable = xtv, value = 5, comm = sel).grid(row=5,column=0, sticky="w")
R7=Radiobutton(win, text = "500us", variable = xtv, value = 6, comm = sel).grid(row=6,column=0, sticky="w")
R8=Radiobutton(win, text = "250us", variable = xtv, value = 7, comm = sel).grid(row=7,column=0, sticky="w")
R9=Radiobutton(win, text = "100us", variable = xtv, value = 8, comm = sel).grid(row=8,column=0, sticky="w")
R10=Radiobutton(win, text = "50us", variable = xtv, value = 9, comm = sel).grid(row=9,column=0, sticky="w")
R11=Radiobutton(win, text = "25us", variable = xtv, value = 10, comm = sel).grid(row=10,column=0, sticky="w")
R12=Radiobutton(win, text = "10us", variable = xtv, value = 11, comm = sel).grid(row=11,column=0, sticky="w")
R13=Radiobutton(win, text = "5us", variable = xtv, value = 12, comm = sel).grid(row=12,column=0, sticky="w")
R14=Radiobutton(win, text = "2,5us", variable = xtv, value = 13, comm = sel).grid(row=13,column=0, sticky="w")
R15=Radiobutton(win, text = "1us", variable = xtv, value = 14, comm = sel).grid(row=14,column=0, sticky="w")
R16=Radiobutton(win, text = "500ns", variable = xtv, value = 15, comm = sel).grid(row=15,column=0, sticky="w")
g1 = Label(win, text = "Ch1 Gain").grid(row=0,column=2, sticky="e")
R17=Radiobutton(win, text = "10mV", variable = g1v, value = 0, comm = sel1).grid(row=1,column=2, sticky="e")
R18=Radiobutton(win, text = "20mV", variable = g1v, value = 1, comm = sel1).grid(row=2,column=2, sticky="e")
R19=Radiobutton(win, text = "50mV", variable = g1v, value = 2, comm = sel1).grid(row=3,column=2, sticky="e")
R20=Radiobutton(win, text = "100mV", variable = g1v, value = 3, comm = sel1).grid(row=4,column=2, sticky="e")
R21=Radiobutton(win, text = "200mV", variable = g1v, value = 4, comm = sel1).grid(row=5,column=2, sticky="e")
R22=Radiobutton(win, text = "500mV", variable = g1v, value = 5, comm = sel1).grid(row=6,column=2, sticky="e")
R23=Radiobutton(win, text = "1V", variable = g1v, value = 6, comm = sel1).grid(row=7,column=2, sticky="e")
R24=Radiobutton(win, text = "2V", variable = g1v, value = 7, comm = sel1).grid(row=8,column=2, sticky="e")
R25=Radiobutton(win, text = "5V", variable = g1v, value = 8, comm = sel1).grid(row=9,column=2, sticky="e")
g2 = Label(win, text = "Ch2 Gain").grid(row=0,column=3, sticky="e")
R26=Radiobutton(win, text = "10mV", variable = g2v, value = 0, comm = sel2).grid(row=1,column=3, sticky="e")
R27=Radiobutton(win, text = "20mV", variable = g2v, value = 1, comm = sel2).grid(row=2,column=3, sticky="e")
R28=Radiobutton(win, text = "50mV", variable = g2v, value = 2, comm = sel2).grid(row=3,column=3, sticky="e")
R29=Radiobutton(win, text = "100mV", variable = g2v, value = 3, comm = sel2).grid(row=4,column=3, sticky="e")
R30=Radiobutton(win, text = "200mV", variable = g2v, value = 4, comm = sel2).grid(row=5,column=3, sticky="e")
R31=Radiobutton(win, text = "500mV", variable = g2v, value = 5, comm = sel2).grid(row=6,column=3, sticky="e")
R32=Radiobutton(win, text = "1V", variable = g2v, value = 6, comm = sel2).grid(row=7,column=3, sticky="e")
R33=Radiobutton(win, text = "2V", variable = g2v, value = 7, comm = sel2).grid(row=8,column=3, sticky="e")
R34=Radiobutton(win, text = "5V", variable = g2v, value = 8, comm = sel2).grid(row=9,column=3, sticky="e")
R35=Radiobutton(win, text = "AC", variable = g3v, value = 0, comm = sel3).grid(row=10,column=2, sticky="e")
R36=Radiobutton(win, text = "DC", variable = g3v, value = 1, comm = sel3).grid(row=11,column=2, sticky="e")
R37=Radiobutton(win, text = "AC", variable = g4v, value = 0, comm = sel4).grid(row=10,column=3, sticky="e")
R38=Radiobutton(win, text = "DC", variable = g4v, value = 1, comm = sel4).grid(row=11,column=3, sticky="e")
R39=Radiobutton(win, text = "Trig Ch1", variable = g5v, value = 0, comm = sel5).grid(row=12,column=2, sticky="e")
R40=Radiobutton(win, text = "Trig Ch2", variable = g5v, value = 1, comm = sel5).grid(row=12,column=3, sticky="e")
def tick():
win.after(1000, tick)
d0=gpio.input(26)
sync=0
if(d0==True):
a = datetime.datetime.now()
gpio.output(27, gpio.HIGH)#clk2
for x in range(0,1031):
gpio.output(22, gpio.LOW)#L/H
gpio.output(17, gpio.LOW)#clk1
d1=gpio.input(5)#1
d2=gpio.input(6)#2
d3=gpio.input(13)#5
d4=gpio.input(19)#4
gpio.output(22, gpio.HIGH)
d5=gpio.input(5)#1
d6=gpio.input(6)#2
d7=gpio.input(13)#5
d8=gpio.input(19)#4
gpio.output(17, gpio.HIGH)
ch1[x]=256-(d4*1+d3*2+d2*4+d1*8 + d8*16+d7*32+d6*64+d5*128)
gpio.output(17, gpio.LOW)#clk1
for x in range(0,1031):
gpio.output(22, gpio.LOW)#L/H
gpio.output(27, gpio.LOW)#clk2
d1=gpio.input(5)#1
d2=gpio.input(6)#2
d3=gpio.input(13)#5
d4=gpio.input(19)#4
gpio.output(22, gpio.HIGH)
d5=gpio.input(5)#1
d6=gpio.input(6)#2
d7=gpio.input(13)#5
d8=gpio.input(19)#4
gpio.output(27, gpio.HIGH)
ch2[x]=256-(d4*1+d3*2+d2*4+d1*8 + d8*16+d7*32+d6*64+d5*128)
gpio.output(27, gpio.LOW)#clk2
gpio.output(17, gpio.LOW)#clk1
chx1 = 128
sb = sat[0]
e1 = sb + 478
for x in range(sb,e1):
chx=ch1old[x]
canvas.create_line(x-sb, chx,x+1-sb,chx1, fill="black", width=1)
chx1=chx
for x in range(sb,e1):
chx=ch2old[x]
canvas.create_line(x-sb, chx,x+1-sb,chx1, fill="black", width=1)
chx1=chx
s=0
sen=0
sbt = 0
pretrig = 100
sylevel=127
while(sen == 0 ):
s=s+1
if(s==540):
sen = 1
if (trigch[0]==0):
if (ch1[s] > sylevel s > pretrig):
sbt = 1
if(ch1[s] <= sylevel sbt == 1 ):
sen = 1
if (trigch[0]==1):
if (ch2[s] > sylevel s > pretrig):
sbt = 1
if(ch2[s] <= sylevel sbt == 1 ):
sen = 1
sa = s-pretrig
e=sa+478
sat[0] = sa
for x in range(sa,e):
chx=ch1[x]
ch1old[x]=ch1[x]
canvas.create_line(x-sa, chx,x+1-sa,chx1, fill="green", width=1)
chx1=chx
for x in range(sa,e):
chx=ch2[x]
ch2old[x]=ch2[x]
canvas.create_line(x-sa, chx,x+1-sa,chx1, fill="red", width=1)
chx1=chx
canvas.create_line(390,sylevel,400,sylevel, fill="yellow", width=1)
canvas.create_line(pretrig,0,pretrig,10, fill="yellow", width=1)
canvas.create_line(0,128,400,128, fill="gray", width=1)
canvas.create_line(200,0,200,260, fill="gray", width=1)
for y in range(0,260):
for x in range(0,400):
if(y % 20 == 0 x % 20 == 0):
canvas.create_line(x,y,x+1,y, fill="gray", width=1)
b= datetime.datetime.now()
c = b - a
print (c.microseconds/1000)
else:
time.0.02)
tick()
win.mainloop()
A hozzászólás módosítva: Dec 25, 2021
Én a helyedben ebbe az irányba mennék el. Kell egy stream forrás, ami tolja az adatokat, erre meg már vannak kész megoldások. De most gondolatébresztettél amúgy, ennek én is utána fogok nézni, mert pont kapóra jönne az egyik projektemben
Amit leírtál ott, az nem éppen erről a megjelenítési módról szólt, amiről beszéltem...! Amit leírtam, abban sehol sem törölsz effektíve, csak a legszükségesebb helyen újrarajzolsz! És mivel a teljes kép csak kis része változik kockáról kockára, így átlagban jó nagy a nyereség...
Majd tanulmámyozom. Elkészíthető akkor egy digit szkóp amely nodemcuról megy, és a telefon a kijelző wifin keresztül?
Ha javascriptes (webes) megjelenítést szeretnél, akkor websockettel tudsz vele aránylag kisebb késleltetéssel kommunikálni, de az se lesz szerintem elég gyors.
Ha pythonnal rajzolnál, akkor ajánlom a pyGame használatát, az SDL-el rajzol, azaz kihasználja a hardveres gyorsítást is. Ha egy játéknak elég fps-t tud, akkor egy grafikonnal se lesz baja.
Egyszerű megoldások még: C# és mono, vagy Pascal és lazarus, mind a kettő fordít és fut linuxon (ARMen is) és szinte biztos, hogy van hozzájuk ilyen komponens ami ezt kirajzolja neked gyorsan.
Kipróbáltam jó lett, 256x480 as képernyőt a két csatornával 300ms alatt frissít, ebből 150ms a 2048 adat beolvasása a két RAM ból, elég lassú a raspberry gpio kezelése, mint az arduino digitalWrite megoldása.
Kezelőgombokat (radiobutton) kellene még létrehozni pygame alatt.
A programozása is egyszerűbb mert újra rajzolja ciklikusan a képernyőt, de mégis gyors
Hát igen, sajnos ezen a Linux is lassít amiért nem valós idejű ugye, mint egy kontroller esetében. DMA-t nem tud amúgy a pi? Az sokat tudna rajta gyorsítani, ha lenne esetleg, de erről nincs információm.
Szerkesztés: ja, most esett le, hogy RAMból való olvasás esetén nem feltétlen segítség, ha van dma. A hozzászólás módosítva: Dec 26, 2021
Csak gyorsabb, kifelejtettem hogy a mintavétel is időbe telik, ha a legnagyobb 40Ms/s akkor akkor 10fps a képfrissítés több nem is kell. A tkinter egy másik panelon fut az vezérli az analóg panelt, fapados de nekem így jó. Ha a kép jobb sarkába belekattintok akkor ott megjelenik egy kék vonal ami a szinkron szintet állítja be. Hogy tudjak mérni még azt szeretném hogy ha belekttintok a képbe akkor elmentse a kordinátákat egy fájlba, azt pedig beolvasom egy gombnyomással a DSOPanelen (mert ott tudjuk a beállításokat), így ott ki tudom íratni a feszültséget és az időt.
|
|