Lazarus
Programming => Embedded => Operating Systems => Embedded - AVR => Topic started by: ccrause on June 30, 2019, 10:15:20 pm
-
I am exited to have build a first useful project integrating embedded controller (atmega328P on Arduino Uno board) and desktop app using only FPC as compiler and Lazarus as IDE! The controller collects 1200 10 bit samples in a buffer, which is then transmitted to a PC over serial/USB. The desktop app collect the data and display it in a TChart.
Note that this post is not really about yet another Arduino oscilloscope (Github alone lists 153 projects for Arduino oscilloscope) - I'm exited by having the option of a Pascal toolchain from firmware to desktop software.
-
This is very interesting. Did you program the embedded controller in Pascal or Object Pascal, too? Can you provide a link to the software, its description or a paper about it?
-
Sounds quite impressive. Congratulations! ;D
-
Nice!
I did something similiar with an STM32, also programmed in FreePascal. But not as sophisticated as yours: No trigger, fixed ports and only single shot.
-
Congrats Christo !
Does continuously sends live the data via uart ?
I'm finishing the driver for the enc28j60 ethernet controller (https://github.com/dioannidis/fp_ethernet_enc28j60.git). What do you think, will be possible to send the data via ethernet ?
regards,
-
This is very interesting. Did you program the embedded controller in Pascal or Object Pascal, too? Can you provide a link to the software, its description or a paper about it?
Firmware is pure Pascal, it isn't sophisticated enough to warrant OP. Code: https://github.com/ccrause/LazScope
Does continuously sends live the data via uart ?
I'm finishing the driver for the enc28j60 ethernet controller (https://github.com/dioannidis/fp_ethernet_enc28j60.git). What do you think, will be possible to send the data via ethernet ?
Not really live streaming, it is more a packet of data on request protocol. The GUI requests a data packet from the controller, the controller then read the ADC until the data buffer is full, then sends the data buffer to the GUI.
I think it will be easy to update the firmware to communicate over ethernet (if the ethernet driver can allow a say a 100 millisecond gap to collect and pack the ADC readings).
-
I did something similar, but probably less complete for KOL. NoteTChart is actually a very, very slow component, so I wrote my own (in 2003) with a ~ 10 millisecond resolution and a 64 bit buffer.
I have always loved these kind of projects. Good job!!
-
TChart is actually a very, very slow component, so I wrote my own (in 2003)
Why do you think that TAChart is "very, very slow". Did you apply it properly? And the first commit for TAChart in the Lazarus repository is dated 2007. So how could you say in 2003 that TAChart is slow?
-
I did not write TAChart, I wrote TChart... which is around since Delphi 1..... And slow.
The author of TAchart must have thought the same thing....Reading is an art...
-
Reading is an art...
Yes, and I am aware that I am not the best in it. But in this case your post was misleading because the main chart component of both Delphi and Lazarus is called "TChart". "TAChart" is the name of the entire charting library of Lazarus while that of Delphi is called "TeeChart". So, it was not clear that you mean "TeeChart" when you were talking of "TChart".
-
Rearranged main form, serial port can now be selected from dropdown list. Baud rate could be changed if firmware runs over slower connection. GUI tested on Linux Mint 19.1 and Windows 10.
-
Rearranged main form, serial port can now be selected from dropdown list. Baud rate could be changed if firmware runs over slower connection. GUI tested on Linux Mint 19.1 and Windows 10.
Fantastic! What you've created and the new embedded forum sections made my day!
-
Great!
Now I have to look for my Arduino and find time :)
-
Congratulations!
Can you add this to the wiki? https://wiki.freepascal.org/Lazarus_Application_Gallery (https://wiki.freepascal.org/Lazarus_Application_Gallery)
-
Congratulations!
Can you add this to the wiki? https://wiki.freepascal.org/Lazarus_Application_Gallery (https://wiki.freepascal.org/Lazarus_Application_Gallery)
Thank you. Done.
-
Congratulations!
Can you add this to the wiki? https://wiki.freepascal.org/Lazarus_Application_Gallery (https://wiki.freepascal.org/Lazarus_Application_Gallery)
Thank you. Done.
Updated wiki link: https://wiki.lazarus.freepascal.org/Projects_using_Lazarus_-_Hobby_software#LazScope
-
A new version of the LazScope (https://github.com/ccrause/LazScope) project has been released. A few bug fixes and an 8 bit mode was added.
Attached an example trace of a middle C note played on a laptop and captured over the headphone jack.
-
Nyquist?
https://en.wikipedia.org/wiki/Nyquist_frequency
The graph overshoots so the sampling is not correct. Not good for your ears. Just like my Marshall 130 watt clone is not good to my ears: London City, just from 1966 1969, made in Amsterdam. The latter is less painful than sampling overshoots and more mellow, but too loud.
Anything recorded like that can be thrown away.
What it shows is ear problems and a bad mixer (human, not table)
And even if it is called "concert pitch" it is waaaaay to high. (My Piano tuned at 402, which is low, but more natural)
-
A new version of the LazScope (https://github.com/ccrause/LazScope) project has been released. A few bug fixes and an 8 bit mode was added.
Attached an example trace of a middle C note played on a laptop and captured over the headphone jack.
Hello Ccrase.
Out-of-the-box, brilliant, nice and fast.
Big wow + congrats.
Fre;D
-
Nyquist?
https://en.wikipedia.org/wiki/Nyquist_frequency
The sample frequency is about 63 kHz, so should be fine for capturing a 261 Hz sine wave.
The graph overshoots so the sampling is not correct. Not good for your ears. Just like my Marshall 130 watt clone is not good to my ears: London City, just from 1966 1969, made in Amsterdam. The latter is less painful than sampling overshoots and more mellow, but too loud.
Anything recorded like that can be thrown away.
This is a "pure" sine wave sample file, played via my laptop sound chip and sampled with a simple wire via blocking capacitor and DC offset resistor divider (https://github.com/ccrause/LazScope/blob/master/images/DC_offset_circuit.png) connected to a headphone jack. Most of the noise in the plot is probably due to either low quality onboard amplifier or ambient electromagnetic interference picked up by the unshielded probe wire. Note that even a Rigol DS1102E oscilloscope with a proper shielded probe shows significant noise for this, so the problem is probably somewhere between the sound chip and the location of the probe.