Showing posts with label Electrical Engineering. Show all posts
Showing posts with label Electrical Engineering. Show all posts

Wednesday, June 6, 2018

What is Hardware in the Loop (HIL) and Software in the Loop (SIL) Testing?


Subscribe by Email!
By Gabriel Staples
Written: 6 June 2018
Last Updated: 7 June 2018

Quadcopter navigation algorithm SIL test (live video).
In mechatronics and control theory, testing is an important part of controller validation. You need to run experiments to prove that your software/analog/digital controller, actuator, algorithm, etc, does what it’s supposed to do. Experiments, however, can be expensive, time-consuming, difficult,
dangerous, or even impossible to test under all conditions. Therefore, you can do Hardware in the Loop (HIL) testing and Software in the Loop (SIL) testing/simulation to aid the testing, verification and validation of your controller without having to resort to pure, fully-physical testing with actual products under actual conditions.


***Subscribe by Email!***

Sunday, October 1, 2017

Arduino sine wave siren code using a lookup table in flash memory (PROGMEM)


Subscribe by Email!
By Gabriel Staples
Posted: 30 Sept. 2017
Last Updated: 30 Sept. 2017

Related Articles:
Other Articles:
(*Articles containing or linking to source code are marked with an asterisk)
Demo Video: 



***Subscribe by Email!***

Saturday, January 16, 2016

One of my current projects: Arduino police siren w/simple, custom transistor amplifier/speaker driver circuit


Subscribe by Email!
By Gabriel Staples Written: 16 Jan 2016
Last Updated: 2 Oct. 2017
History (newest on top):
2 Oct. 2017 - link to source code added
16 Jan 2016 - first written

A Few Other Articles:
So, a few days ago I got a car horn *and* a car audio speaker to play a siren sound!

In these two videos, I do a quick desktop demo of playing a siren sound through first a "fixed frequency" car horn, and then through a standard car audio speaker, rated at 120W peak, 60W RMS, and 4 Ohms. Using an Arduino, a relatively simple, custom transistor-based amplifier circuit, and the Arduino core tone() function in my code, I drive the horn and speaker to play a siren sound by sinusoidally varying the driving frequency.  I also show the signal to the devices on an oscilloscope, and briefly discuss and hook up a Schottky diode in a "snubber diode" configuration to knock down the inductance-induced voltage spikes created each time the square wave has a falling edge.

First, watch the "fixed frequency" type car horn play a varying-frequency siren sound:



***Subscribe by Email!***

Thursday, June 11, 2015

100+V Arduino/AVR Microcontroller Input/Output (I/O) Pin Over-Voltage Protection Using a *Single* Resistor!


Subscribe by Email!
By Gabriel Staples
Written: 11 June 2015
Last Updated: 2 Sept. 2015
Update History (newest on top):
-Added "Upfront Caveat", 2 Sept. 2015
-Added lots of extra info, & the Figures, 21 July 2015

Related Articles:

Here I present a pin protection method for very high and low input voltages that I learned from Atmel themselves, in their Application Note "AVR182: Zero Cross Detector."

If you've read my article titled "Arduino Power, Current, and Voltage Limitations" you know that the pin input voltage limits are as follows:
Maximum Input Voltage: Vcc + 0.5V, or +5.5V for a 5V Arduino
Minimum Input Voltage: -0.5V

However, if you simply add a single resistor in series with any input pin, you can protect it against higher or lower input voltages, with some caveats!

Ex: simply by placing a 10k resistor in series on an input pin, you get input voltage protection up to +15.5VDC and down to -10.5VDC. With a 100k resistor you get input voltage protection up to +105.5VDC, and down to -100.5VDC. Keep reading to learn more.

WARNING: 
-FOR YOUR PERSONAL SAFETY, WHEN USING THIS TECHNIQUE, I RECOMMEND THAT YOU DO NOT WORK WITH INPUT VOLTAGES GREATER THAN APPROXIMATELY 100VDC OR 20VAC UNLESS YOU KNOW WHAT YOU ARE DOING AND HAVE READ ALL OF MY WARNINGS HEREIN, INCLUDING THE ADDENDUM AT THE END OF THIS ARTICLE. 
-REGARDLESS OF WHAT INPUT VOLTAGES YOU ARE USING, YOU AND ONLY YOU ARE RESPONSIBLE FOR YOUR PERSONAL EXPERIMENTS, PRODUCTS, DESIGN DECISIONS, AND THE SAFETY OF YOU AND YOUR CUSTOMERS.

Upfront Caveat:
Though this technique may work, and be good for home-projects or quick prototyping, better techniques are recommended, especially if you are producing a commercial product. Redundancy is your friend. Using external, rated clipping diodes is certainly a better option than relying on the internal, integrated and unrated ones. For better protection techniques, including using *external* clipping diodes for redundancy, and adding transient voltage suppression, read more here: Science Prog: Using current limiting resistors on AVR I/O pins. Also see the AVR182 Application Note for references to additional sources to read in order to add extra pin protection.

Background & Concept:

***Subscribe by Email!***