So You Want to Build Electronics The equipment you need to get started in building electronics. If you look back through the last two years of posts on this blog, you'll see my relatively rapid transition from absolute beginner in electronics to someone who is formidable enough to have their work at least noticed (See HaD every other month). This means I've been fielding a lot of questions from beginners online as to how exactly to get started, and what to buy, and what to do with it. And to answer this, I keep having to pull up the same links to the basic stuff. The obvious beginner answers are the juggernaut kits from places like the Maker Shed, and I will never knock them for putting together a perfectly reasonable starter kit (which despite your intuition, is actually reasonably priced), but I've never been really interested in them. So here is a gigantic list of everything I would buy right now to replace my entire workshop if mine were to disappear.
Secrets of Arduino PWM Pulse-width modulation (PWM) can be implemented on the Arduino in several ways. This article explains simple PWM techniques, as well as how to use the PWM registers directly for more control over the duty cycle and frequency. This article focuses on the Arduino Diecimila and Duemilanove models, which use the ATmega168 or ATmega328. If you're unfamiliar with Pulse Width Modulation, see the tutorial. PWM has several uses: Dimming an LED Providing an analog output; if the digital output is filtered, it will provide an analog voltage between 0% and 100% . Simple Pulse Width Modulation with analogWrite The Arduino's programming language makes PWM easy to use; simply call analogWrite(pin, dutyCycle), where dutyCycle is a value from 0 to 255, and pin is one of the PWM pins (3, 5, 6, 9, 10, or 11). Probably 99% of the readers can stop here, and just use analogWrite, but there are other options that provide more flexibility. Bit-banging Pulse Width Modulation Using the ATmega PWM registers directly
ATmega168A Pulse Width Modulation – PWM - Protostack Dimming an incandescent bulb is easy. Simply adjust the current down using a potentiometer and you are done. Dimming an LED is another story entirely. With PWM the LED is turned on and off many times per second. LED dimming is not the only application of PWM. Source Code Example 1 The example below produces a PWM waveform with a 20% duty cycle. #include <avr/io.h>#include <util/delay.h> #define LED_PORT PORTC#define LED_PIN 0#define LED_off() LED_PORT&=~_BV(LED_PIN)#define LED_on() LED_PORT|=_BV(LED_PIN)int main (void){ DDRC = 0b10000000; while (1) { LED_on(); _delay_ms(2); LED_off(); _delay_ms(8); } return(0);} For most embedded applications, controlling PWM this way is not practical. PWM output lines on ATmega168A The ATmega168A microcontroller has 3 timers which in turn can control 6 PWM lines. On each timer, the ATmega168A has 4 modes that produce a PWM wave form. Each of the 6 PWM output lines can be set into 1 of 4 output modes. Fun with RGB LEDs Source Code Example 2 Downloads
PWM Learning Examples | Foundations | Hacking | Links The Fading example demonstrates the use of analog output (PWM) to fade an LED. It is available in the File->Sketchbook->Examples->Analog menu of the Arduino software. Pulse Width Modulation, or PWM, is a technique for getting analog results with digital means. Digital control is used to create a square wave, a signal switched between on and off. In the graphic below, the green lines represent a regular time period. Once you get this example running, grab your arduino and shake it back and forth. Written by Timothy Hirzel Foundations
L'électronique de zéro Bonjour à toutes et à tous ! Si vous êtes ici, même s'il s'agit d'un hasard, c'est qu'il y a une très grande probabilité que vous ayez envie de vous documenter ou d'apprendre l'électronique. Quels sont les principes de base ? Comment connaître les composants et pouvoir les utiliser pour faire des montages ? Comment faire ses propres montages ? Telles sont les questions auxquelles nous vous amèneront des réponses afin de satisfaire vos besoins sur le sujet. Nous commencerons le cours "en douceur" par les formules et les lois nécessaires et fondamentales à connaitre en électronique. Sachez toutefois que le domaine de l'électronique est tellement vaste que nous ne pouvons pas vous présenter toutes les facettes de cette science. Avis donc à tous les amateurs, les hobbyistes, les professionnels et les étudiants : vous venez de dénicher la perle rare !
AnalogWrite Reference Language | Libraries | Comparison | Changes Description Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to analogWrite(), the pin will generate a steady square wave of the specified duty cycle until the next call to analogWrite() (or a call to digitalRead() or digitalWrite() on the same pin). The frequency of the PWM signal on most pins is approximately 490 Hz. On most Arduino boards (those with the ATmega168 or ATmega328), this function works on pins 3, 5, 6, 9, 10, and 11. The Arduino Due supports analogWrite() on pins 2 through 13, plus pins DAC0 and DAC1. You do not need to call pinMode() to set the pin as an output before calling analogWrite(). The analogWrite function has nothing to do with the analog pins or the analogRead function. Syntax analogWrite(pin, value) Parameters pin: the pin to write to. value: the duty cycle: between 0 (always off) and 255 (always on). Returns nothing
10A H-Bridge Motor Controller - Introduction Motor control is the core heart of robotics. Without locomotion or any movement a robot is dull and lifeless. The H-bridge is a tried and true concept for DC motor control. It allows you to move motors forward, backward and with varying speeds through PWM (pulse with modulation). This tutorial will take a few steps back from the all-in-one L298 or LMD18245 motor control ICs and look more into how we can build our own H-bridge without the need of an IC. 10A H-Bridge Test Video 10A H-Bridge Completed 10A H-Bridge PCB And All Parts 10A H-Bridge With PWM Input Purpose & Overview of this project The main goal for this tutorial is to build a 10 AMP motor controller that can control a DC motor with a digital input.
PWM - La modulation de la largeur d'impulsion Introduction Arduino permet de faire du contrôle de sortie en digital (tout ou rien) ou en analogique (de 0 à 5v en 256 paliers). Cela peu sembler amplement suffisant... mais présente néanmoins des limites importantes. Arduino est également capable de faire du contrôle de sortie par "modulation de largeur d'impulsion". Cette méthode permet de combler les manquements du contrôle analogique. Les limitations du contrôle analogique Lorsque l'on désire contrôler la luminosité d'une Led ou encore la vitesse d'un moteur DC, le fait d'appliquer une tension plus faible ou plus importante (contrôle analogique) n'implique une obtention des résultats voulu. Le contrôle par longueur d'impulsion Reprenons l'exemple de la led. Cela fonctionnerait à l'identique pour un moteur DC. Le graphique ci-dessous montre la modulation du signal de sortie (PWM) en fonction du pourcentage du cycle de service. Contrôle PWM avec Arduino Activation du mode PWM Cycle de service Plus d'informations
Lab 14: Inter-Integrated Circuit (I2C) communication I2C (Inter-Integrated Circuit) is a short distance serial interface that requires only 2 bus lines for data transfer. It was invented by Philips in 1980′s, originally to provide easy on-board communications between a CPU and various peripheral chips in a TV set. Today, it is widely used in varieties of embedded systems to connect low speed peripherals (external EEPROMs, digital sensors, LCD drivers, etc) to the main controller. In this experiment, we will cover an overview of I2C protocol, its implementation in PIC microcontrollers, and the method of connecting single and multiple devices on a common I2C bus. I2C devices with PICMicro Theory I2C bus has two lines: a serial data line (SDA) and a serial clock line (SCL). Both SCL and SDA lines are open drain drivers, and are therefore, connected to a positive supply voltage through pull-up resistors. Start and Stop conditions Signaling for Start and Stop conditions I2C device addressing Data transfer Acknowledgment Serial EEPROM (24LC512) Output
Introduction to Pulse Width Modulation (PWM) by Michael Barr Pulse width modulation (PWM) is a powerful technique for controlling analog circuits with a processor's digital outputs. PWM is employed in a wide variety of applications, ranging from measurement and communications to power control and conversion. Analog electronics An analog signal has a continuously varying value, with infinite resolution in both time and magnitude. Analog voltages and currents can be used to control things directly, like the volume of a car radio. As intuitive and simple as analog control may seem, it is not always economically attractive or otherwise practical. Digital control By controlling analog circuits digitally, system costs and power consumption can be drastically reduced. In a nutshell, PWM is a way of digitally encoding analog signal levels. Figure 1 shows three different PWM signals. Figure 1. Figure 2 shows a simple circuit that could be driven using PWM. Figure 2. PWM controllers Many microcontrollers include on-chip PWM controllers.
Arduino and the AREF pin Learn how to measure smaller voltages with greater accuracy using your Arduino. This is chapter twenty-two of our huge Arduino tutorial series. Updated 12/12/2013 In this chapter we’ll look at how you can measure smaller voltages with greater accuracy using the analogue input pins on your Arduino or compatible board in conjunction with the AREF pin. Revision You may recall from the first few chapters in our tutorial series that we used the analogRead() function to measure the voltage of an electrical current from sensors and so on using one of the analogue input pins. And when we say the operating voltage – this is the voltage available to the Arduino after the power supply circuitry. This can easily be demonstrated by connecting an Arduino Uno to USB and putting a multimeter set to measure voltage across the 5V and GND pins. This is important as the accuracy of any analogRead() values will be affected by not having a true 5 V. Why does analogRead() return a value between 0 and 1023?
Modulation PWM Utiliser la sortie PWM des PIC Les PIC ont la possibilité souvent inutilisée de générer des signaux PWM . Le programme que nous vous proposons ici décrit la façon de configurer un PIC 16F877 pour générer un signal PWM. Il a été testé sur notre platine d'expérimentation mais peut être utilisé tel quel sur tous les PIC de la série 16F87X. La deuxième partie de cet article décrit comment générer un signal pseudo sinusoidal à l'aide du signal PWM du PIC Un signal PWM est caractérisé par sa période et son rapport cyclique. Le 16F877 permet de définir la période du signal PWM. Periode = (PR2+1) x 4 x Tosc x (TMR2 prescaler) Dans notre programme, les valeurs sont les suivantes: PR2 = 77, Tosc est la période de l'oscillateur, à 12 Mhz => 1/12000000 = 83,3 nS, TMR2 prescaler est le prédiviseur du Timer 2, il a été mis à 1. On trouve donc par l'application de la formule une période de 26 µS pour le signal PWM. Le programme de test: PWMtest.C Il s'agit d'un signal quasi sinusoidal de fréquence 2200 Hz.
Tutorials The most fun you can have (after blinking LEDs) is using sensors to detect whats going on in the world and act on that information. However, all sensors have their own methods of interfacing. That can make them a real pain to work with: some need pull-up resistors, some need certain power supplies, some use lots of power, some don't. Since there aren't that many different sensors that people tend to want to use I have collected the most common sensors with code examples and wiring diagrams. Tutorials include: Force sensitive resistor - Used to detect physical pressure such as pinching, squeezing, pushing, brushing.