Posts | Comments

Planet Arduino

Archive for the ‘ATTiny 85’ Category

Screenshot of debugging the Wokwi Arduino simulator

Being able to track down a bug in a mountain of source code is a skill in its own right, and it’s a hard skill to learn from a book or online tutorial. Besides the trial-by-fire of learning while debugging your own project, the next best thing is to observe someone else’s process. [Uri Shaked] has given us a great opportunity to brush up on our debugging skills, as he demonstrates how to track down and squish a bug in the Wokwi Arduino simulator.

A user was kind enough to report the bug and include the offending Arduino sketch. [Uri]’s first step was to reduce the sketch to the smallest possible program that would still produce the bug.

Once a minimal program had been produced, it was time to check whether the problem was in one of the Arduino libraries or in the Wokwi simulator. [Uri] compiled the sketch, loaded it onto a ATtiny85, and compared the behavior of the simulator and the real thing. It turns out the code ran just fine on a physical ATtiny, so the problem must have been in the Arduino simulator itself.

To track down the bug in the simulator, [Uri] decided to break out the big gun—GDB. What follows is an excellent demonstration of how to use GDB to isolate a problem by examining the source code and using breakpoints and print statements. In the end, [Uri] managed to isolate the problem to a mis-placed bit in the simulation of the timer/counter interrupt flag register.

If you’d like to see more of [Uri]’s debugging prowess, check out his dive into an ATtiny’s write protection and configuration fuses. If you’ve been wowed by the power of GDB and want to learn more, check out this quick tutorial!

DC to DC conversion has come a long way. What was once took an electromechanical vibrator and transformer has been reduced to a PC board the size of a largish postage stamp that can be had for a couple of bucks on eBay. So why roll your own buck-boost converter for the ground up? Maybe because sometimes the best way to learn is by doing.

When it comes to clear and succinct explanations, [GreatScott!] has you covered. We recently reported on one of the videos from his Electronic Basics series, but the video below covers the slightly more advanced topic of DC-DC conversion in depth. [GreatScott!] describes how buck converters and boost converters work as separate entities, and how they can be integrated into a non-inverting buck-boost converter. He further simplifies that circuit into an inverting buck-boost, and sets about explaining the limitations of the circuit. With the addition of an op amp to provide feedback to control the duty cycle of the ATtiny85, the buck-boost overcomes its limitations and keeps a solid set point regardless of load or supply voltage.

If you’re looking to get into the theory of DC-DC conversion by putting it into practice, this is a great project to get you started. It’s also a good review for the old hands, as are most of [GreatScott!]’s videos. They’re worth checking out.

 


Filed under: Arduino Hacks, classic hacks


  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook