Using Modern C++ Techniques With Arduino

C++ has been quickly modernizing itself over the last few years. Starting with the introduction of C++11, the language has made a huge step forward and things have changed under the hood. To the average Arduino user, some of this is irrelevant, maybe most of it, but the language still gives us some nice features that we can take advantage of as we program our microcontrollers.

Modern C++ allows us to write cleaner, more concise code, and make the code we write more reusable. The following are some techniques using new features of C++ that don’t add memory overhead, reduce speed, or increase size because they’re all handled by the compiler. Using these features of the language you no longer have to worry about specifying a 16-bit variable, calling the wrong function with NULL, or peppering your constructors with initializations. The old ways are still available and you can still use them, but at the very least, after reading this you’ll be more aware of the newer features as we start to see them roll out in Arduino code.
Continue reading “Using Modern C++ Techniques With Arduino”

The Science Behind Boost Converters

[Ludic Science] shows us the basic principles that lie behind the humble boost converter. We all take them for granted, especially when you can make your own boost converter or buy one for only a few dollars, but sometimes it’s good to get back to basics and understand exactly how things work.

The circuit in question is probably as simple as it gets when it comes to a boost converter, and is not really a practical design. However it helps visualize what is going on, and exactly how a boost converter works, using just a few parts, a screw, enameled wire, diode, capacitor and a push button installed on a board.

The video goes on to show us the science behind a boost converter, starting with adding a battery from which the inductor stores a charge in the form of an electromagnetic field. When the button is released, the magnetic field collapses, and this causes a voltage in the circuit which is then fed through a diode and charges the capacitor a little bit. If you toggle the switch fast enough the capacitor will continue to charge, and its voltage will start to rise. This then creates a larger voltage on the output than the input voltage, depending on the value of the inductor. If you were to use this design in a real life application, of course you would use a transistor to do the switching rather than a push button, it’s so much faster and you won’t get a sore finger.

This is very basic stuff,  but the video gives us a great explanation of what is happening in the circuit and why. If you liked this article, we’re sure you’ll love Hackaday’s own [Jenny List] explain everything you need to know about inductors.

(updated thanks to [Unferium] – I made a mistake about the magnetic field collapsing when the button is pressed , When in reality it’s when the button is released that this happens. Apologies for confusion.)

Continue reading “The Science Behind Boost Converters”

Don’t Forget: Bring A Hack Munich Is Tonight

If you’re in Munich, Germany this weekend and you’ve got a sweet hack to show off and a thirst for beer and/or good geeky company, then you’re in luck! Come join Hackaday at the muCCC for a Hackaday Prize Bring a Hack.

The location is Schleißheimer Str. 41, a short walk west along Heßstraße from the Theresienstraße U-Bahn. No reservation is needed, but it’d be swell if you’d let us know in the comments that you’re coming (or better yet, click the “join this event” button in the upper right of the event page) so that we have enough pizza on hand.

The party starts at 20:00, not entirely coincidentally as soon as exhibitor setup at Make Munich closes. So if you’re setting up a booth, come on over to the other side of town where you can show off a small project to a select audience of fellow hackers. If you’re only going to be attending Make Munich, this is a great warm up.

Hackaday’s [Elliot Williams] will be there and taking photos if you’ve got something portable that you’d like to show the world! Otherwise, relax and hang out with kindred spirits. Need a time and place to get a team together for the Hackaday Prize? Here, with beer! (Or Spezi, but nothing rhymes with Spezi.)

Many thanks again to our hosts at Munich’s CCC.

MATLAB And Simulink For Zynq

Although we see a lot of MATLAB use in industry and in academia, it isn’t as popular in the hacker community. That’s probably due to the cost. If you’ve ever wondered why companies will pay over $2000 for the base product, you might enjoy the video of a webinar covering using MATLAB and Simulink (a companion product) to program the CPU and FPGA on a Zynq Zedboard. Not interested because of the price? If you aren’t using it for commercial purposes, it isn’t as bad as you think.

MathWorks is one of those companies that likes to market by virtually giving away products to students with the hope that they’ll adopt the same tools when they land jobs in industry. Their flagship product, MATLAB, is well-entrenched in the labs and offices of big corporations. We’ve often thought that MATLAB is sort of what FORTRAN would look like if it had been developed in the last 20 years instead of 60 years ago. It is true that a base license for MATLAB is over $2000. However, if you aren’t using it for commercial purposes, and you can’t score a student license, you can get a personal license of MATLAB for about $150. The extra modules are also similarly reduced in price. If you are a student, the price drops to about $100, although many schools have licenses students can use at no cost to them.

If you watch the video from [Noam Levine], you’ll see you get your money’s worth. If you are wanting to configure the FPGA directly, this isn’t for you. But if you just want to accelerate a program by pushing DSP or other algorithms that can benefit from hardware assistance, MATLAB makes it very easy.

Continue reading “MATLAB And Simulink For Zynq”