Sometimes you gotta solder and sometimes you gotta spend? I have been using junk laptops at my bench for years, castoffs with broken trackpads, slow CPUs, dim screens ready to bite the big one. Some of them run Linux, some of them MacOS, occasionally Windows.
Too much crap, it had to stop.
New NUC Windows 10 System |
NUC ME UP SCOTTY!
Sooo.....I got out the credit card and bought an Intel NUC10I7FNH running Windows 10 Pro. Yes, Windows. Yes, Microsoft. I guess this day had to come. Too many software packages I wanted to run seem to work best with Windows, and perhaps Windows OS gets us all in the end.
Intel based desktop PCs may one day be a thing of the past, but for now, the NUC abides; it's tiny, bench friendly, and packs a wicked punch in a small footprint. Doesn't take up much space on the bench.
OK, it was a fair amount of money. I'll deal with that later.
First thing I want to do with this new PC:
LOGIC ANALYSIS
Sigrok and Roll: If you haven't heard of Sigrok, run, don't walk, and get it here. It's open Source/free software that gets you (among many other things) an electronics logic analyzer at super low cost.
You can buy a super cheap USB Saleae clone (neighbor and fellow audio geek mvcl gave me a $5-$10ish 24Hhz/8 probe he had sitting around as a gift--thanks dude).
Pulseview is the logic analysis GUI tool that comes with Sigrok. If you work with digital electronics, a decent logic analyzer is essential. Pulseview is fantastic and is FREE.
Something like 130 different protocols are decoded (here) which includes "stack decoders"--what your data means without having to constantly look at the IC's datasheet; I/O formats (here); DMM UI is here. CLI is here.
Since Sigrok is open source you can learn how things work by studying its code. This sort of thing restores my faith in humanity. Recommended viewing: an extremely informative video and tutorial, from one of the guys who wrote Pulseview, is here.
"Windows Wins": I couldn't get the Pulseview or CLI Mac DMGs to install on my Macbook Pro; then I spent an entire evening trying to compile Sigrok from source on Fedora 29 before giving up and installing the it via yum . But, the yum build of Sigrok for Fedora 29 kept crashing, so, I installed it on Windows.
It works, but you have to manually install drivers for the Salae clone frequently. Read on.....
MVCL's gifted $10 Saleae Clone. Note the broken grabber. Yeh, I did that. |
Here are steps to get the Saleae clone working with Windows 10:
- Run Zadig for pulseview/Windows; list all devices (Zadig comes with Pulseview)
- In the Zadig app, find the fx2lafw device from the drop down
- If necessary change the driver for fx2lafw to "WinUSB"
- Note: Inside the Zadig app, even when the driver is listed as "WinUSB", I have seen the saelae clone frequently not recognized by Windows until I click the Reinstall Driver button. So--reinstall what appears to already be installed....
- Careful! Don't change drivers for any other devices....
- Open Pulseview/Windows
- Click on the down arrow at the top+center of the pulseview window > connect device
- Choose driver "fx2lafw"
- Click "scan for devices using the driver above"
- Choose the Saleae clone
- You are ready to scan!
Next up: Eagle and Fusion 360. This is for PCB layout and 3D design. I have argued about Eagle vs. Kicad at length with my maker friends; they tell me anyone who doesn't use Kicad should be shot. But as a long time paid subscriber to Eagle, the folks at Autodesk threw in a licensed copy of Fusion 360 "for free" to keep me in their world. It worked; I have no complaints about any of it, except, Eagle is an odd program, but an odd program I sort of know. There must be a girlfriend analogy in there somewhere?
"Windows Wins": I have always used Eagle on Windows, pretty much. I have it on Mac which I never use. For what I do, it's good enough. Update: 10-11-23 Autodesk is discontinuing Eagle. I have moved on to Kicad. See the post here.
Update: 12-7-23 Autodesk is going to start charging a fortune for CAD so I moved to FreeCAD. See the post herehere.
Next up: 3D printing. Been there, done that, post is here. Yes, it all works on Windows. Let's move on.
DEVELOPMENT:
I installed PyCharm Python IDE and Microsoft Visual Studio Community for C/C++ programming.
Amazing that there are personal versions of these excellent programs, compiled for Windows for $0. "The Cherno" has great Youtube videos covering Visual Studio Community on Windows, here.
And: for AVR development: Atmel Studio 7 for Windows, get that here. Good low key videos about basic set up and use for Atmel Studio are here.
For compiling C++, outside of Visual Studio, I installed minGW, mostly to debug C functions for embedded systems without having to flash an MPU over and over. After getting that going however, I discovered a C compiler "cl" (compile/link?) that can be run from the Visual Studio terminal, info here. Works great!
I also installed VSCODE--excellent free software from Microsoft--which I have been using for RP2040 development (wait--excellent free software from Microsoft? In one sentence? Bill Gates has retired?)
For when I am not using the amazing Online GDB website here for C and C++ experiments and rapid development, I also installed CodeBlocks for Windows--awesomely powerful and free.
Linux On MS Windows?
Cats, sleeping with dogs? Turns out Windows has surprisingly good and easy to install Linux virtualized hosts you get for free (well, after you buy W10, right?).
It's called "Windows Subsystem for Linux" or WSL.
Current version as of the writing of this blog post is WSL2. Check out WSL2 here. I got that along with the Fedora WSL build (here) since I mostly work with Redhat/Centos/Fedora Linux, but Ubuntu is available for free here as well as Debian, SUSE and a few others.
To get at Windows data from the the Linux VM open the WSL2 Linux system and cd to /mnt/c/[windows_foldername], cool!
"Windows Wins (or does it)? WSL2 is command line only. Damn. I want to be able to run gnome and so on. Can we find a way to get this going? You'd need to be able to run X11 on the WSL2 host.....we need an Xwindows server on WSL2.
Um, no. Doesn't work. I installed a Ubuntu WSL2 VM, but then I burned up at least 5 hours trying to get x-windows processes of any stripe running. To make a long story short--DOH!--the problem: WSL2 can't run systemd and you need that for X11!!
But, I did find a way to get a GUI working on WSL2 Ubuntu, see video here. Another post about the same thing is here.
Both solutions use Windows RDP protocol to get at the Ubuntu GUI, and thus doesn't need a WSL2 X11 server.
Update 3-10-21 this is described in the videos above but I often find myself forgetting: if you follow the instructions to set up an xrdp GUI on Ubuntu, you need to start the xrdp daemon each time or else RDP session will fail.
Command to do that:
sudo /etc/init.d/xrdp start
Another way to generate a GUI from WSL2 would be to run Xwindows on Windows and then use DISPLAY exports from the WSL2 VM....I'll figure out that another day.
Update 5-16-21 OK this method works as well. X11 windows on Windows!! Indeed--cats sleeping with dogs.
Use VcxSrv.
Get VcxSrv here. Amazing--works great! I had no idea.
Good video about this is here.
To get it going, run xcxsrv on windows, then go to the Ubuntu WSL2 VM and the issues these commands:
DISPLAY=[windows10 IPV4address]:0 (example: DISPLAY=192.168.1.22:0)
export DISPLAY
Then to test we can run something like xclock:
xclock
Another tool for Linux folks on Windows is cygwin, which allows users to run familiar Linux commands right from the Windows terminal (e.g., tools like grep).
I downloaded and did a default install. You have to update environment PATH for the cygwin commands to be found by the OS, info about how to do that is here. I think every windows machine needs cygwin.
UPDATE, 3-19-22: I read that Windows 11 natively supports their own version of X Windows for WSK2 (so no need to run XRDP ) but I haven't tried it yet--read more here.
UPDATE 4-2-22: After a lot of time spent with WSL2, I ended up purchasing and installing VMware Workstation Pro, at USD $199 it's not freeware, but what's my time worth? I installed VMware WS on the NUC, then installed an Ubuntu 20.10 virtual machine inside that.
Seems to work, as does hijacking the host's USB communications for things like PROM programmers, MCU/dev board firmware programmers, and so on--the things a maker needs a Linux system for--so for example I can program an Arduino from Windows or the Linux VM.
UPDATE, 9-10-22: an interesting alternative to XRDP, WSL2, and VsxSrv, for running Linux Xwindows apps on MS Windows, is MobaXterm. Powerful app and free for home use. Very easy to use: you install it on Windows, create an SSH session, choose the IP of the target Linux system running X11, type in the user you want to use and go. A lot of other uses. MobaXterm is recommended!
For my Ubuntu VM I had to do literally zero setup after running the Windows installer for Mobaxterm.
I've had MobaXterm on the the bench for a few weeks and so far has worked flawlessly--using MobaXterm any X app for Linux I run on the Ubuntu virtual machine or Rasperry Pi has run seamlessly on the bench Windows NUC. Once again, it's FREE for home use and makers. This is a must-have piece of software I think for anyone running a mixed Windows/Linux environment. Amazing!!!!
UPDATE 10-8-23 I continue to love MobaXterm--amazing free program to run x11 apps on windows--but for Linux Mint Cinnamon 21 I had to to install a few additional Linux services so MobaXterm would work:
install openssh: sudo apt-get install openssh-server -y (SSH was not installed by default on my downloaded iso of Mint.
turn on remote X11: in /etc/lightdm/lightdm.conf.d create a file called 100-custom.conf with this content: [Seat Defaults] xserver-allow-tcp=true
make sure port 6000 is listening (google that if you don't know how, I allowed x11 through ufw)
after that I could create an SSH session to the laptop running Mint and (to test) type xclock at the Xmobaterm prompt. I see the x11 clock on my windows PC--it works.
UPDATE 5-20-24: VMware Workstation pro is now free! Details are here. Good thing too, because VMware also bludgeoned the crap out of my employers this month by jacking the subscription cost of ESXI through the roof.
VERSION CONTROL: GIT AND GITHUB
Someone has to say it: You can't do any sort of efficient code work without version control. Especially if you have machines all over as I do: work, home, laptops, etc.--and expect any sort of efficiency hopping from system to system.
The leader right now is git (here) and github (here). Windows git is very similar to Linux, except for the damn carriage returns. I won't go into detail about how to install and use git and github, maybe that's for a future post, but, there is already an absolute ton online to get you started.
But!!! if you don't know the basics of using Git and github, run, don't walk, download and install them, then take a few hours to learn their basics (good basics tutorial is here).
Yes you heard that from audiodiwhy and everywhere else: Once you are managing your code and project files using git I think you will wonder how you ever survived without them.
Once installed, you can run oh-my-posh for Windows to beautify the github cursors. This means installing Windows Terminal (here), oh my posh (here), getting a font for Windows Terminal (Meslo nerd font--here) and then invoking it by altering the settings json file (use PowerShell within Terminal--which works--here).
Update 5-20-24: I kept having to set up new machines with Git so I created a post so capturing my process for doing so. Post is herehere. Mostly useful to me, but hey, it's an audiodiwhy universe.
BENCH AUTOMATION
I went down yet another rabbit hole because the bench tool automation provided by Sigrok doesn't support most of my Siglent bench devices.
Yep--Siglent. I know there is discussion about Siglent's poor security measures, politics surrounding this stuff, etc., but I can't afford top shelf bench gear, and based on my own limited EE skills (read my posts, is it obvious?) it'd be pearls before swine if I bought a gazillion dollar Keysight scope. Yep, for many of us do it yerself makers, Siglent is affordable and works!
Sigrok led me to online discussions of controlling all my Siglent bench gear with Python, which led me to National Instruments NI-VISA. That way all my lab bench gear can be controlled from the new W10 system and a Python front end I can program any way I want.
PUT IT ON YOUR NI-VISA:
What is VISA? Like MIDI, a bunch of manufacturers got together and came up with the a protocol for that would work across their different wares.
For those with way too much time--the Wikipedia for VISA is only a few paragraphs--read more about the history of the VISA protocol here.
Great that manufacturers agreed on the VISA protocol, but what do we use to send information from a PC to a VISA compliant piece of test gear?
We can send read-only and "change a setting" sort of statements to our VISA bench gear using a protocol called SCPI (I have heard this called "skippy").
Fine: how to get SCPI going?
Download free Windows (Windows only!) software from National (here).
Install all of that.
Next, hook a USB cable between your computer and your lab gear. Ethernet works as well, assuming your bench device supports it.
The other SCPI?? |
An aside: I work with IP networking all the time, so I tried to get ethernet going with my new NUC and my various Siglent bench dookies that had an RJ45 jack; all worked well with static IPV4; all except my 3303 Siglent power supply.
IPv4 seemed buggy on that device--at the very least, the static IP settings seemed to get wiped each time I power cycled, but it was way more bizarre than that. I called up Siglent support, not expecting anything (when can you ever get decent tech support nowadays?) and to my amazement the tech at Siglent US support picked up the phone and talked to me! He was super friendly and helpful, but due to covid didn't have a 3303 at his home work setup to test. He was going to work on it.....and, after some more emails back and forth--Siglent got back to me very quickly--GO SIGLENT!!--I ended up using USB, which NI-VISA supports, works well on the power supply, and now, happily, the 3303 is recognized just fine by the W10 computer.
Back to it: NI-VISA, you installed that already right? It gives you the necessary drivers for your W10 machine to talk to your bench gear.
Next, you can use NI-MAX (it is included in the giant NI-VISA download) to search for and probe each VISA device, and finally run basic commands--see the siglent how to here--to see if everything is working.
AUTO-MATE: Of course!! Python has a module for that. The PyVISA module gets it done; get it here. Running PyCharm Community (here) and the latest version of Python for Windows (here), I created this code to first recognize my bench gear, and then generate 2K ramp wave on CH1 of my Siglent SDG1025.
Python code looks like this (you can get the latest version of my SCPI python scripts from github, here.)
######################
import pyvisa
rm = pyvisa.ResourceManager()
print(rm.list_resources())
#terminal now shows all the VISA devices found.
# this should match what you see in NI-max
# Devices are long strings like what you see in the next line; set this to a pyvisa object....
avg = rm.open_resource('USB0::0xF4ED::0xEE3A::SDG10GAD1R1738::INSTR')
print(avg.query('*IDN?'))
# that prints out all your VISA stuff.....
#new waveform, ramp, 2K, 0 sym,
avg.write('C1:BaSic_WaVe WVTP,RAMP')
avg.write('C1:BaSic_WaVe SYM,0')
avg.write('C1:BaSic_WaVe FRQ,2000')
####################
TERMINATED? If you read the pyvisa docs (here) it talks about termination characters, necessary to get some SCPI devices to work. Yes, seen that too. For instance to download device details of my Siglent SPD3303X-E power supply here is an example;
rm = pyvisa.ResourceManager()
#print(rm.list_resources())
print(rm)
a = rm.list_resources()
print(a)
p = rm.open_resource('USB0::0x0483::0x7540::SPD3XHBX2R0646::INSTR')
p.read_termination = '\n'
p.write_termination = '\n'
p.query('*IDN?')
#####################
OK and here's some working code to set basics on a SPD3303X-E supply:
Update 12-28-20 I found I had to add some sleep() to the 3303 code as well or else sometimes the power supply would miss an updated settings push....Again, you can get these SCPI python scripts from my github, here.
############CHANGE THIS####################
ch1 = 5 #voltage ch1
ch2 = 12 #voltage ch2
amp1 = .50 #max curr ch 1
amp2 = .20 #max chrr ch 2
#turn channels on or off
x = "On"
########################################
value1 = x.upper()
value2 = x.upper()
value3 = x.upper()
rm = pyvisa.ResourceManager()
#print(rm.list_resources())
#print(rm)
a = rm.list_resources()
print(a)
p = rm.open_resource('USB0::0x0483::0x7540::SPD3XHBX2R0646::INSTR')
p.read_termination = '\n'
p.write_termination = '\n'
p.query('*IDN?')
#qq = p.query('*IDN?')
#print(qq)
p.read_termination = '\n'
p.write_termination = '\n'
ch1volts = 'CH1:VOLTage ' + str(ch1)
ch2volts = 'CH2:VOLTage ' + str(ch2)
ch1curr = 'CH1:CURRent ' + str(amp1)
ch2curr = 'CH2:CURRent ' + str(amp2)
ch1onoff = 'OUTPut CH1,' + value1
ch2onoff = 'OUTPut CH2,' + value2
ch3onoff = 'OUTPut CH3,' + value3
p.write(ch1volts)
p.write(ch2volts)
p.write(ch1curr)
p.write(ch2curr)
p.write(ch1onoff)
p.write(ch2onoff)
p.write(ch3onoff)
From here, think of the possibilities? For the waveform generator, how about every second the frequency jumps up 1K (or whatever) and when it gets to 10K goes back down to 1K. That's a simple loop, with the 2000 replaced by a variable.
For the power supply, read the voltage, and if it drops well below the voltage set initially, turn off the channel after say 2 seconds, since you probably have a short....
Of course there are other ways to do all this, but, VISA and Python makes it, really, too easy.
Update 8-26-23. For more automation fun I added multichannel DAC/ADC from Expert Sleepers with Reaktor to my bench. Not free, but I have had fun with it, and who cares about credit card debt?
Post is here.
BELCHED? BURRRP BENCHED!!
OK that's enough for one weekend. Yes, the NUC set me back, as did the Salae LA and VMware, and the expert sleepers ADDA but the rest of it--cost me what--$10? Incredible!! The original builds were all open source/free and the results were amazing.
I think bench gear has become similar to home studio recording equipment in that it used to cost a fortune but not any more, and best of all, if I can do this, well, anyone can.
Until next time--don't mask debate--automate!
No comments:
Post a Comment