Transcription
Hello and welcome to this episode for Electromaker. I'm your host and maker, Robin Mitchell.
In today's episode, we will learn how to turn all of this into this. Um, no, that's a dragon fruit. Sorry, let's try that again. Ah, there we go! We will learn how to take all of this equipment and replace it with a single device called, as I reach for it, the Red Pitaya.
So let's get straight to it. [Applause] [Music]
Electronic engineers require a variety of essential tools to effectively design, test, and troubleshoot electronic systems. Among these tools, oscilloscopes, analyzers, and data capture devices play a crucial role.
Oscilloscopes allow engineers to visualize electrical signals in real time, enabling them to analyze waveforms and detect anomalies in circuit behavior. Analyzers, such as spectrum analyzers and logic analyzers, provide deeper insights into the frequency components of signals and the logical states of digital circuits, respectively.
Data capture devices are also indispensable, as they enable engineers to record and analyze data over time, seeing how various things relate to each other, such as power consumption, data buses, and sensor operation.
However, for those looking to learn electronics, this equipment can be extremely hard to get, especially for those who just don't have the budget. I mean, take a look at my stuff; it's ancient.
While there are certainly devices out there that try to combine these tools to make such setups more economical, they are often lacking in performance features or are obscenely expensive. Well, this is where the Red Pitaya comes in.
I have seen the Red Pitaya many times. I've seen it at trade shows, I've seen it in action on YouTube doing things I can't comprehend, and I have seen it advertised in stores all over. Yet, when I look at its description, honestly, I couldn't figure out for the life of me what it is.
Well, after sitting down with the creators of this fantastic device for a good hour, I was finally able to understand what it is, what it does, and quite frankly, why you need to really grab one of these things for yourself.
However, I also learned that engineers who build brilliant things, such as the Red Pitaya, become so engrossed in their designs that they forget the audience, such as myself, are complete lemons.
So get ready, because for the first time in history, I will be describing what the Red Pitaya is in a way that actually makes sense. Are you ready for this? Here we go!
The Red Pitaya is a Linux computer that has an FPGA stuck to it, which then has an analog front end stuck to that. The FPGA on this device can be programmed independently, so it can be made to do any digital signal processing your heart desires.
The analog front end allows you to measure all kinds of analog signals. Now, the FPGA itself is stupidly fast, which means that it can access I/O at crazy speeds. This also means that you can create complex digital circuits that respond to I/O entirely independently from the main processor.
You can make things like state machines controlling buses. The FPGA can communicate with the main processor to transfer data, but remember, this link won't be in real time like reading and writing to GPIO on the FPGA.
Now, this is important to note because it means that the FPGA, for example, could toggle its I/O in the megahertz. But while the connection between the FPGA and the CPU is fast, it will be block transfers that later get processed by code.
Thus, you can't write code on the CPU to toggle the GPIO at megahertz speed inside of Python or even C. Instead, you would write an FPGA program, run that program on the FPGA, and use a link between the two to read and write data as needed.
So a close analogy for this device is kind of like having an FPGA connected to a desktop PC via a PCIe card or USB, and then you would connect a really awesome analog front end to that FPGA.
Now, there is no point in saying how awesome this board is if we don't dive into some of its specs. Well, starting at the analog front end, it supports signal bandwidths up to 50 MHz. Now, that's not the maximum frequency, but the bandwidth, which is entirely different.
The connected ADC for sampling data can provide up to 125 mega samples per second with a 14-bit resolution. Moving on to the FPGA and the CPU, the two are combined into a single SoC, which itself has a dual-core ARM Cortex A9 MP core and an AMD Xilinx Zynq 710 with 512 MB of RAM, micro SD storage up to 32 GB, and both USB 2.0 and 1 GB Ethernet.
You will find there are plenty of resources on this machine. The inclusion of pin headers allows for breakout boards to be attached, and there's even an Arduino shield on this thing, so you can expand this board with more hardware.
In fact, there is even a Click Shield available, which allows you to use the MicroE range of Click boards, thus accelerating development time while reducing construction complexity. In fact, I think I have it around here somewhere. Aha! Here it is.
Now, how do we use the Red Pitaya? Well, just like with many single-board computers, the Linux system is first launched on the machine, and you can then SSH into it to run programs, make changes, and develop further.
This capability allows for remote management and development, making it easier to work on projects without needing direct access to the hardware. However, there is no display port, nor is there a port for connecting keyboards and mice, so get used to using this thing entirely over the network.
So long as you can get an Ethernet connection to it, you're sorted. In addition to SSH, SCPI server commands can be used to communicate with the Red Pitaya from other machines, providing a standardized way to control and interact with the device programmatically.
I'm so proud I said that; it was so hard to pronounce! This allows for automation and integration with other systems, enhancing the versatility of the Red Pitaya in various applications.
With regards to programming languages, there are plenty to choose from, but the two that stand out to me are Python and C. Both of these have well-supported libraries that can natively be used on the machine and remotely, and quite frankly, I think they're the best two languages in existence. Cue the comment section storm!
Now, Python would be useful for situations where you want to focus on productivity, getting a concept working at speed, while C would be more ideal for those who need to focus on performance.
However, the Red Pitaya also works well with other more abstract environments, such as MATLAB and LabVIEW. This means that you can create extremely complex data analysis systems that would otherwise be somewhat complex to design in lower-level languages.
At the same time, thanks to the use of Linux, you can also use bash scripts to perform automated tasks. When it comes to programming the FPGA, you will need to use the Xilinx Vitis IDE.
This integrated development environment is essential for designing and implementing your FPGA applications, as it provides a comprehensive set of tools for simulation, synthesis, and debugging, making it easier to develop complex designs.
There are libraries that make interacting with the FPGA a breeze, simplifying the process of programming and controlling the hardware. These libraries abstract much of the complexity involved in FPGA development, allowing users to focus on their application rather than the underlying hardware details.
There is also a really nice web app interface for accessing the tools on the Red Pitaya, which adds another layer of convenience. This web interface allows users to interact with the device through a graphical user interface, making it accessible even to those who may not be as comfortable with command line operations, such as myself.
It provides an intuitive way to visualize data, configure settings, and control various functions on the Red Pitaya without needing to rely solely on SSH or SCPI commands. This is quite cool because it means it's quite easy to hide this thing in an enclosure, workbench, wall, ceiling, or even inside the system of a toilet.
Such versatility in placement allows for creative solutions in various environments, whether it's home automation, IoT projects, or even discrete surveillance systems.
So now it's time to unbox the Red Pitaya. As you can see here, we have an absolutely gorgeous box, and I mean, this is such a lovely thing for a product to come in, so I really appreciate the effort.
Now, there are some scratches and marks, but that's me; that's not Red Pitaya. That's because I'm clumsy, and I've already opened this up. So when we open it up fully, you're going to see that some boxes are missing and some plastic containers are missing, and everything's kind of all over the place because I have been playing with this already.
Now, the kit that we actually have here specifically is the STEMLab 125-14 EDU pack, so this gives you a very specific set of parts, including a nice little shield for adding little extra bits and bobs on, and it gets you some probes and stuff like that.
So without further ado, let's open it up. You can see how many times this thing's been opened; I've absolutely abused it. Right, so here's our messy box, which has not been put back properly, and I shall put it forward and we'll take out the items one by one.
So the first thing we're going to go for is the Red Pitaya itself. Now, as you notice, the Red Pitaya actually comes with a whole bunch of little accessories for connecting to the SMA connectors and the various bits and bobs.
So this is the first part that you get: your Red Pitaya. Now, the next thing of note are the BNC connectors, which is great. These BNC connectors will allow you to probe signals; you can do all kinds of magical stuff with them.
But because these types of BNC connectors have BNC, you can't connect those to the SMA, so Red Pitaya kindly gives you two of these SMA to BNC connectors so you can then connect them to the various channels, and they screw on very, very nicely like that.
So these probes are an absolute godsend. So I'm just going to go ahead and get those wrapped up properly, and then we will put them to the side. Here we go, pop that in all nice and neat.
So we've got some probes right there. They give you an Ethernet cable, of course, because how else are you going to connect your Red Pitaya to your local network? They also give us a power adapter with all the different options here, so depending on what country you are, you might want to go for a different plug.
And that's really great because it means it targets basically every country in the world. So it doesn't matter where you're from; you're always going to be able to power your Red Pitaya, which is great.
Of course, we got a pair of these nice little grounding clips for the BNC probes. Very, very important. Now, they also give you a nice little shield that sits on top of the Red Pitaya so that you can connect your Red Pitaya to various different sensors and different I/O systems.
So this is another really cool thing to give you, and it just sits on top like that, or maybe like that. I think it's that way, actually. Yeah, it's that way. But yep, that's a nice little addition that you get.
Now, when it comes to logic signals, they give you these DuPont star connectors, and you also get a whole bunch of these little logic probe clamps. Now, this combined with a Red Pitaya means that you can do some really cool logic analyzer stuff, so this is a really nice addition to the kit.
Now, this is a really interesting thing; these are actually pigtails. Now, initially, I thought these were for antennas, maybe for RF and stuff, but actually, they're for connecting and synchronizing different clocks across different Red Pitayas, which means you can daisy chain them up.
So this is very, very important for those doing advanced stuff. Now, of course, we've also got these little standoffs, which are important for when you're using add-on boards with a Red Pitaya to make sure that everything sort of stabilizes and stays nice and solid.
We've got a couple of these kind of like balanced junctions, which are very, very useful for when taking two parts out of an RF port or an RF in or an RF out. So that's another really useful little part to have.
They also give you an enclosure, which is nice, and they put it in bubble wrap, but I'm going to go ahead and quickly open it up and get it out. So you get a nice little acrylic enclosure so you can keep your Red Pitaya safe, and also with a nice little fan port too, which is great.
And we got a nice little probing tool, which is also very important for adjusting trim pots and trim capacitors and stuff like that. They also give you a pre-programmed SD card for running programs on the Red Pitaya, and it comes in the form of a micro SD card, but they also give you the nice adapter, which is great, and it's a Samsung, so it's a good quality one.
And last but not least, obviously, a bit of swag there; you've got your two little stickers with your Red Pitaya address on, and you must keep this safe because without this, you will not be able to figure out what address to connect to when working with a Red Pitaya over the network.
So do you remember when I said that you need an Ethernet connector to make the Red Pitaya work? Well, my workshop, which is still under construction, doesn't have Ethernet on that side where I kind of wanted to test it.
So right now, I have no other choice than to connect it directly to my home server. Now, in order to test the Red Pitaya for the time being, I've got two BNC probes that came with the kit. I'm going to connect one to the in, one to the out, and connect them together.
That way, when we send signals out of the out, it goes into the in. But let's see how that works out. So we just connect this to that, we connect the power. Now, there's two USB ports for power; make sure you put it into power because the other one's just a USB to connector.
And once we've done that, we'll connect the BNCs together like so, just one to the in and one to the out. One's in, the other one is in nicely screwed on. Make sure that they're both grounded together and then they are touching each other like so.
Right, awesome! And then the last thing I need to do is power it up and connect the Ethernet. And I'm looking at this whole thing, and I'm thinking my power is nowhere nearby, so we're going to need an extension cord, I think.
Right, let's plug into port number 11. That looks great; that's really professional. Now I just need another adapter. Yep, okie dokie! I have found a power port that is free. I will lift him up here, I will now plug him in, and we will see the magic in 3, 2, 1. Bob's your uncle!
And hopefully, we've got some lights that are now beeping over here. Beeping? They blink anyway. Let's see if we can pop this somewhere else so it's kind of out of the way.
I'm pretty sure the crew at Red Pitaya is absolutely screaming in their nightmares at what I'm about to do. Let's bring those two up, shove the Red Pitaya through that. That is not a good idea.
Let's just put him up there where he's not going to disturb anybody, pick up the power cable, and then we'll just shove the power cable there. And now he's in! So he's now up there, probes are touching each other, we can go online and now test the Red Pitaya.
Please don't hate me, Richard! So with the Red Pitaya plugged into the Ethernet on my local network, powered up, we are ready to go.
But first, before we jump into actually using the Red Pitaya, let's just look at the resources that it comes with and why the Red Pitaya is a fantastic platform.
So if we go over to the screen here, this is the quick start page that you can use to figure out how to get your Red Pitaya to boot, connect to it, and do some stuff.
So you can see that in less than like a 5-minute video, you know, you get straight to the point. And what's really, really nice is that you've got a bunch of different questions that you can go through.
There's all kinds of applications and features that you can go through, developer guides, just pretty much everything that you can think of. And for those who really want to focus on the learning side, then there's also the Red Pitaya teaching materials.
Now this page is awesome because you've got so many things to look at here. We've got learning FPGA programming, which is a massive part of the Red Pitaya, as we all should know.
Now, basics of digital systems, basics of Verilog FPGA programming. So again, this is not just a case of, "Oh, here's how you program an FPGA." We're going down to the basics of how to actually use this thing.
Again, we've got the basics of electronics, resistor circuits, transient response, analog filters, everything you could possibly need to know when working with advanced electronic systems.
And it just keeps going, and it just keeps going, and it's amazing how all of this is free. So the Red Pitaya is an absolutely phenomenal machine, and the stuff that it comes with and all the resources around it make it ever more important.
But of course, I know what you're waiting for: to actually use the Red Pitaya. So I got myself a herbal tea; I'm not allowed to have coffee anymore. Almost drank a tea bag right there.
Now let's do it! Now, do you remember when I said that you have these little stickers that have the actual web address to get to your Red Pitaya? Well, every single Red Pitaya has its own unique serial, so it's so important that you don't lose this.
Now, in my case, mine, if I go to a new tab, it is RP-DAS-F0A56.local. Now, if you're wondering if it's a zero or an O, just remember this is hexadecimal, so it'll be zero; you won't have an O in that.
We hit enter, and assuming I'm not a complete idiot, it will load up the Red Pitaya web server. Don't be an idiot like me; make sure your SD card is actually pushed in and not half sitting out.
Let's see what happens if we reload now. Now, I'm not expecting it to be this fast. Oh, check it out! That took like less than 30 seconds.
So now that the Red Pitaya web app is loading, it is all local to the machine, and we can access it over the browser. We can start to play with the different things that it comes with.
Now, of course, this is not the only thing you can do with it; you can upgrade it, you can put your own software on there, you can write your own programs. But for the sake of this video, we're just going to look at the pre-installed software that comes with the Red Pitaya.
Now, straight out of the box, this thing is going to give you a whole bunch of tools to start working with, including oscilloscopes, spectrum analyzers, and logic analyzers.
Now, while that's really cool, what makes it even cooler is that these are all software-based, and they're taking advantage of the combination of the FPGA and the analog front end.
And the reason why that is so awesome is because not only can you reprogram it to do different things if, let's say, a new tool becomes available in the future, but it also means that you can configure this platform in any way you want, and it's all done in software.
You have the hardware ready, but the hardware is not fixed, so that makes the Red Pitaya honestly awesome. So now that everything is ready to go, I think the first tool we should look at is the oscilloscope because this, to me, is kind of like the most basic tool; it's the most fundamental tool that you're going to use.
Now we've got a sine wave here going at 1 kHz, and what I wanted to show was just how stable and clean this is. Now, the way that we've managed to get this to work is that we've got an in and an out, and the out has been configured into a signal generator.
Now, I've used the sweep function, but I've set it to like one sort of just one GHz. You can do burst modes and stuff like that, but I think the sweep is a really cool one, and we can change it so that it oscillates between two different frequencies like this.
And this was just done with, you know, a push of a button, and it's really easy to use. I figured out how to use all the software within a space of like 2 minutes after booting it up. It's honestly really cool to use.
Now, tools like oscilloscopes are great, but I think there's something a little bit more special, and that is the spectrum analyzer. So if we go over to the spectrum analyzer, what makes it really cool is that we can actually probe and look at signals and see what frequency components they're made of.
Now, what's really important about that is that there are going to be times as an engineer when you're working on a circuit, and you can't figure out why something is noisy or something has some kind of ringing somewhere or there's some kind of interference.
This tool is what's going to allow you to find those frequencies. Now, you could spend all your time doing the complex math trying to find out what it is; this thing makes it all graphical.
So a great example to show the difference between things like sine waves and square waves is to just do an example. So the first thing I'm going to do is I'm going to turn off the output signal generator.
So this is the absolute bare minimum. What we can see right here is we probably have some noise around here. I'm guessing this is probably about the 50 Hz sort of range, the main frequency that's always going to interfere in everything around here because it's such a big component in modern signals, you know, the mains.
But everything else is nice and quiet. Now, if we inject a sine wave, a pure sine wave, and let's make it one megahertz—that is a million, that's one, two, three, four, five, six—and we put that in, what we're going to see is we've got this huge signal right here at the beginning.
This is where most of the signal is, and then we've got some harmonics every so often. Now, this is going to be as a result of the FPGA generating that sine wave, so there's going to be some kind of interferences and some kind of like square wave sine wave conversion.
So you're going to get little things like that, and they'll bleed through. But if it was a pure sine wave, you would basically have no other component in this graph.
If we switch it to square, look at how much more we get on these other fundamentals, and that's because square waves are supposedly the summation of a bunch of infinite sine waves at different harmonic frequencies.
So what's really cool about this is that we can use this tool to see signals inside a circuit, why they exist, and how we can basically get rid of them. Because let's say, for example, this was a power supply circuit, like a DC-DC switching mode power supply, and you saw this great big signal at about 40 MHz.
You might be able to put in some capacitors and inductors to target that frequency and eliminate it completely. And that's why spectrum analyzers are so important when trying to minimize things like EMI and EMC for product certifications.
Now, another feature that I think we need to look at is how this thing can be reprogrammed with new tools, and you do it through the application marketplace. Now, this is where it gets really awesome because I've already actually installed some stuff because I was playing around with it.
But you can go to this marketplace and look for new tools, install them, and see how they behave, or maybe you want some different features. So for example, we've got a different type of spectrum analyzer, so let's install that.
Yeah, remember this is not SSL, but it doesn't matter because it's local. And oh, it's already installed! We click run, and we've now got a brand new application that didn't exist before on this board.
So we can go ahead and play with it. We've got different frequency ranges we can play with. I don't know how you can generate on this channel, but the point is it's there, you know?
So this is a kind of tool that you could make yourself, but clearly someone else has made and given it out to the public. But you could make your own tools in Python, C, as we said before. There are lots of options for you to use.
And here is another example of an application I downloaded earlier, which is the power analyzer. And again, this could be something that's very useful for those who are designing power supplies and want to measure current, voltage, power consumption, trying to minimize the energy waste and trying to maximize efficiency.
So this is just another example of how the Red Pitaya can be modified and changed to your whim as and when you need it. So just for example, we've gone between oscilloscopes, we've gone between logic analyzers, we've got spectrum analyzers, power supply detectors—it's ridiculous!
So just to show you the power of the Red Pitaya, we've managed to go through like four or five different tools, and in that time, the Red Pitaya has reprogrammed itself in a matter of seconds, loaded the necessary software applications and libraries and extensions, and just works in your browser.
And so imagine all of my hardware here being replaced by one small single-board computer for the rest of my career.
Now, one more feature which I want to point out, which I'm not going to go into depth, but to just sort of demonstrate the simplicity of the Red Pitaya, I want to go and show you the coding section.
And the reason why I want to show you this is because things like Python and the libraries that come with it make programming things like the Red Pitaya so trivial. So I'm just going to load up some basic digital examples for using the SCPI commands, and you can see in the code that that is all you need to make it work.
We have a bunch of import libraries, get the SCPI library, get the—oh look at that, it's actually the host name; it's not even the IP address. That's what it's called; it's called the host name.
You go down some system arguments; this is in case you want to kind of like send it to your program like as a system argument in the terminal, send the data, and it is done. And that is how simple it is to play around with a GPIO on the Red Pitaya.
So you have got unbelievable amounts of power in this thing. You can control it remotely, you can control it locally, you can access it over the internet. I think you should put it on a VPN so you could access it anywhere in the world.
It could replace all of the equipment you got in your workshop. It can be reprogrammed; the FPGA gives it high speed, the analog front end makes it absolutely awesome, and my mind is about to explode thinking about all of this.
So yeah, this thing is stupidly awesome! How many times can I say that? Get one now!
If you want to start with a Red Pitaya and need some inspiration, then look no further than the Red Pitaya blog, where you can find some pretty awesome projects, including a ground-penetrating radar, DIY MRI, and even radiation dose meters.
But if you want to start off small, then I would highly recommend using Jupyter notebooks because this allows you to control the Red Pitaya without any preparation needed.
However, I am also old-fashioned, so I would personally use Python on a different machine and access it remotely. This approach will help you become familiar with the programming environment of the Red Pitaya and the use of the necessary libraries.
Using these libraries, you can interface with the various peripherals, analog and digital pins, which will further enhance your programming skills while also learning about SCPI protocols.
For example, you could create an analyzer for capturing I2C, SPI bus data, allowing you to monitor and debug communication between devices effectively. Additionally, you can also create a fully-fledged test script for running long-term tests.
This will enable you to automate the testing process, ensuring your setup remains stable over extended periods. By incorporating long-term tests into your workflow, you can identify potential issues early and then refine your code accordingly.
I would also consider using the direct memory acquisition system in your projects. This system is extremely cool as it saves data from external sources directly into the DDR3 RAM at speeds of up to 125 megabits per second.
This capability allows for high-speed data processing and real-time analysis, which can significantly enhance your applications, especially for digital signal capturing.
If using Python, you could run a Flask app to act as a backend, while JavaScript, PHP, and HTML could be used as a front end. By combining these languages, you could then create intuitive GUI apps that all run in the browser, thus making your projects cross-platform and remotely accessible.
The Red Pitaya is a versatile tool that can significantly enhance your learning and development journey, whether you're just starting out or approaching retirement.
Now, you may be wondering how this piece of hardware can help you throughout your career. Well, from the moment you begin exploring the world of electronics and signal processing, the Red Pitaya provides an accessible platform that offers extraordinary capabilities on a single-board computer.
The combination of an FPGA and analog front end means that there is no signal domain you can't work with, while its user-friendly interface and extensive documentation make it easy for beginners to dive into hands-on projects.
Taking things further, Red Pitaya, the company, not the board, has an entire knowledge base that teaches everything from the basics of electronics to performing complex tasks on their machines.
Considering that these resources are free, once you get the machine, you really can use it to learn everything there is to know about electronics. As you progress in your career, the Red Pitaya continues to be a valuable asset.
Its capabilities extend beyond basic learning; it really serves as a powerful tool for prototyping and testing advanced applications. Engineers and researchers can leverage its high-performance features to develop innovative solutions, making it an essential companion throughout your professional career.
This is largely because it can be reprogrammed for any application, allowing users to adapt it to their specific needs and projects. That means if you need a high-speed RF system, well, it can do that. But then if you need a high-speed logic analyzer, well, it can do that too.
This flexibility basically guarantees that the Red Pitaya can meet a wide range of technical requirements, making it suitable for projects and applications. Moreover, the ability to run Linux and server applications for full access makes this thing really powerful.
This feature allows users to implement custom software solutions, manage data efficiently, and even integrate it with other systems seamlessly. It opens up a world of possibilities for advanced users who want to push the boundaries of what the Red Pitaya can do, enabling them to create tailored solutions that fit their unique project needs.
Even as you approach retirement, the Red Pitaya continues to remain relevant. It offers opportunities for lifelong learning and exploration, allowing you to engage in personal projects or even better, mentor others in the field.
The Red Pitaya is a programmable data acquisition platform, and that statement now makes sense because, well, we actually know what it is and what it does.
The unique combination of features, including high-speed data processing, integrated FPGA, and analog front end, allow users to easily handle any and all signals, both analog and digital.
While the ability to remotely access the Red Pitaya allows for rapid development and deployment of new ideas, regardless of wherever you are, the use of pre-programmed tools further helps those new to the Red Pitaya, as it allows for the device to be used immediately for probing, measuring, and doing all manner of cool logic things.
Of course, we have only touched the surface of the Red Pitaya. You see those SATA ports? They're not SATA; they are for connecting this board to other Red Pitaya boards, but we'll look at that in a future video.
While there are other products out there that try to claim that they are similar, none come close to this machine in terms of versatility and performance.
All in all, the Red Pitaya is an unbelievable machine that honestly blows my mind with its digital signal capabilities, its awesome analog front end, its use of an integrated FPGA, and small size, all while being extremely affordable and being able to replace all my bench equipment.
If you want to get your hands on one of these machines and want to show your support for our work, then head over to the Electromaker store, where you can get this and all manner of things you could possibly need for your next project.
And while you're at it, like and subscribe to this channel. This is Robin Mitchell, signing off.