[Ted] recently demonstrated the analysis of an RL circuit using a piece of paper, Octave, and LTSpice. If you prefer, the Octave code should work fine in MATLAB, as well. If you are looking to get serious about electronic theory this is a reasonably simple case and is a good chance to get a workout with some of the tools.
We like the approach because too often it is easy to just use the computer and not pick up the understanding that you get when working through a problem by hand. You do need to understand complex numbers, but, overall, the math isn’t too hairy.
Continue reading “Phasors In LTSpice”
There comes a moment when our project sees the light of day, publicly presented to people who are curious to see the results of all our hard work, only for it to fail in a spectacularly embarrassing way. This is the dreaded “Demo Curse” and it recently befell the SIT Acronis Autonomous team. Their Roborace car gained social media infamy as it was seen launching off the starting line and immediately into a wall. A team member explained what happened.
A few explanations had started circulating, but only in the vague terms of a “steering lock” without much technical detail until this emerged. Steering lock? You mean like The Club? Well, sort of. While there was no steering wheel immobilization steel bar on the car, a software equivalent did take hold within the car’s systems. During initialization, while a human driver was at the controls, one of the modules sent out NaN (Not a Number) instead of a valid numeric value. This was never seen in testing, and it wreaked havoc at the worst possible time.
A module whose job was to ensure numbers stay within expected bounds said “not a number, not my problem!” That NaN value propagated through to the vehicle’s CAN data bus, which didn’t define the handling of NaN so it was arbitrarily translated into a very large number causing further problems. This cascade of events resulted in a steering control system locked to full right before the algorithm was given permission to start driving. It desperately tried to steer the car back on course, without effect, for the few short seconds until it met the wall.
While embarrassing and not the kind of publicity the Schaffhausen Institute of Technology or their sponsor Acronis was hoping for, the team dug through logs to understand what happened and taught their car to handle NaN properly. Driving a backup car, round two went very well and the team took second place. So they had a happy ending after all. Congratulations! We’re very happy this problem was found and fixed on a closed track and not on public roads.
[Ottverse] has an interesting series in progress to demystify video compression. The latest installment promises to explain discrete cosine transforms as though you were five years old.
We’ll be honest. At five, we probably didn’t know how to interpret this sentence:
…the Discrete Cosine Transform takes a set of N correlated (similar) data-points and returns N de-correlated (dis-similar) data-points (coefficients) in such a way that the energy is compacted in only a few of the coefficients M where M << N.
Still, the explanation is pretty clear and we really liked the analogy with the spheres and the stars in a constellation.
Continue reading “Video Compression Explainer — Like We’re Five-Year-Olds”
[Monica] wanted to try a bit of facial detection with her Raspberry Pi and she found some pretty handy packages in MATLAB to help her do just that. The packages are based on the Viola-Jones algorithm which was the first real-time object detection framework for facial detection.
She had to download MATLAB’s Raspbian image to allow the Pi to interpret MATLAB commands over a custom server. That setup is mostly pretty easy and she does a good job walking you through the setup on her project page.
With that, now she can control the Pi in MATLAB: configure the camera, toggle GPIO, etc. The real fun comes with the facial detection program. In addition to opening up a live video feed of the Pi camera, the program outputs pixel data. [Monica] was mostly just testing the stock capabilities, but wants to try detecting other objects next. We’ll see what cool modifications she’s able to come up with.
If MATLAB doesn’t quite fit your taste, we have a slew of facial detection projects on Hackaday.
The guitar ‘Toing’ sound from the ’70s was epic, and for the first time listener it was enough to get a bunch of people hooked to the likes of Aerosmith. Reverb units were all the rage back then, and for his DSP class project, [nebk] creates a reverb filter using Matlab and ports it to C++.
Digital reverb was introduced around the 1960s by Manfred Schroeder and Ben Logan. The system consists of essentially all pass filters that simply add a delay element to the input signal and by clubbing a bunch together and then feeding them to a mixer. The output is then that echoing ‘toing’ that made the ’80s love the guitar so much. [Nebk]’s take on it enlists the help of the Raspberry Pi and C++ to implement the very same thing.
In his writeup, [nebk] goes through the explaining the essentials of a filter implementation in the digital domain and how the cascaded delay units accumulate the delay to become a better sounding system. He also goes on to add an FIR low pass filter to cut off the ringing which was consequent of adding a feedback loop. [nebk] uses Matlab’s filter generation tool for the LP filter which he includes the code for. After testing the design in Simulink, he moves to writing the whole thing in C++ complete with the filter classes that allows reading of audio files and then spitting out ‘reverbed’ audio files out.
The best thing about this project is the fact that [nebk] creates filter class templates for others to play with. It allows those who are playing/working with Matlab to transition to the C++ side with a learning curve that is not as steep as the Himalayas. The project has a lot to learn from and is great for beginners to get their feet wet. The code is available on [GitHub] for those who want to give it a shot and if you are just interested in audio effects on the cheap, be sure to check out the Ikea Reverb Plate that is big and looks awesome.
The electricity on the power grid wherever you live in the world will now universally come to you as AC. That is to say that it will oscillate between positive and negative polarity many times every second. The frequency of 50 or 60Hz just happens to be within the frequency range for human hearing. There’s a lot more than this fundamental frequency in the spectrum on the power lines though, and to hear those additional frequencies better you’ll have to do a little bit of signal processing.
We first featured this build back when it was still in its prototyping phase, but since then it’s been completed and used successfully to find a number of anomalies on the local power grid. It takes inputs from the line, isolates them, and feeds them into MATLAB via a sound card where they can be analyzed for frequency content. It’s been completed, including a case, and there are now waterfall diagrams of “mystery” switching harmonics found with the device, plus plots of waveform variation over time. There’s also a video below that has these harmonics converted to audio so you can hear the electricity.
Since we featured it last, [David] also took some feedback from the comments on the first article and improved isolation distances on his PCB, as well as making further PCB enhancements before making the final version. If you’ve ever been curious as to what you might find on the power lines, be sure to take a look at the updates on the project’s page.
Continue reading “Listening To Mains Power, Part 2”
The essence of hacking is modifying something to do a different function. Many of us learned as kids, though, that turning the family TV into an oscilloscope often got you into trouble.
These days, TVs are flat and don’t have high voltage inside, but there’s always the family robot, often known as a Roomba. Besides providing feline transportation, these little pancake-shaped robots also clean floors.
If you don’t want to evict the cat and still get a robust domestic robot platform for experimentation, about $200 will get you a Roomba made to be hacked — the iRobot Create 2. [Gstatum] has a tutorial for using a Raspberry Pi and MATLAB to get one quickly running and even doing basic object recognition using the Pi’s camera.
The code even interfaces with Twitter. The impressive part is the code fits on about a page. This isn’t, however, completely autonomous. It uses a connected phone’s sensor’s so that the phone’s orientation controls the robot’s motion, but the robot does use sensors to prevent driving into walls or falling off a cliff. It also can detect being picked up and uses the Pi’s camera to detect a green flag.
Continue reading “Bringing MATLAB To A Vacuum Near You”