loading

This instructable is a calculator to determine the resistor and capacitor values to use in common 555 timer circuits. I have included versions for the RaspberryPi and the Arduino with simple circuits to blink two LEDs like the 555 would. The version for a Linux PC only shows the printed values.

The Idea came from this comment in this instructable where I built a hardware emulator for a 555 using an Arduino.

One thing occurred to me: What about a version, on the Arduino, where the component types and values are simply programmed in software, and thus don't have to exist as solid objects. You select the type of circuit, enter the values of the R + C components, and use either an external pin or software trigger as the source signal.

Steps 1 and 2 are the program and circuit for the RaspberryPi, you will need:

  • RaspberryPi - any model
  • Breadboard
  • Pushbutton switch
  • Red LED
  • Green LED
  • 2 resistors 470-560 Ohm
  • Jumper wires or 22 gauge solid hookup wire *

* You can use male/female jumper wires but one of the Pi Cobblers listed on this page from Adafruit will make it a lot easier: http://www.adafruit.com/search?q=cobbler

.

Steps 3 and 4 are the program and circuit for the Arduino, you will need:

  • Arduino - I use an Uno
  • Breadboard
  • Pushbutton switch
  • Red LED
  • Green LED
  • 2 resistors 470-560 Ohm
  • Jumper wires or 22 gauge solid hookup wire

.

Step 5 is the program for a Linux PC, that is all you need.

Step 6 explains how to run the program.

Step 1: RaspberryPi Circuit

Build the circuit as shown in the picture and the diagram.

The third picture shows a resistor soldered onto an LED. This is optional, but I found that having a bunch of these made up makes breadboarding a lot easier. Solder a resistor to the cathode lead of some LEDs. The cathode lead is the shorter negative (ground) lead.

Step 2: RaspberryPi Program

This project uses the wiringPi libraries, written by Gordon Henderson, for programming the GPIO in C in a style similar to the Arduino IDE.

wiringPi must be installed.

Instructions for download, install and use are located at http://wiringpi.com

wiringPi uses it's own pin numbering scheme. All pin numbers mentioned in the program or in the text are wiringPi numbers unless otherwise specified.

After installing wiringPi you can obtain a list showing the pin numbering for your specific model of RaspberryPi by opening a command terminal and typing: gpio readall

Download this code and copy it into a file on your RaspberryPi and name it 555CalcPi.c.

Compile it with this command:

gcc -o 555CalcPi -Wall -I/usr/local/include -L/usr/local/lib 555CalcPi.c -lwiringPi

Run it with the command: sudo ./555CalcPi


Step 3: Arduino Circuit

Build the circuit as shown in the picture and the diagram.

The third picture shows a resistor soldered onto an LED. This is optional, but I found that having a bunch of these made up makes breadboarding a lot easier. Solder a resistor to the cathode lead of some LEDs. The cathode lead is the shorter negative (ground) lead.

Step 4: Arduino Program

This is the code for the Arduino, pay special attention to the F() macro in the Serial.print statements. when printing a string the compiler creates an array variable to hold the string. In a program like this where there are a lot of strings to print the 2 K of RAM for holding variables will fill up very fast. The F() macro makes the compiler read the string from the 32 K flash memory instead of loading it into the RAM. There is a very brief mention of this in the Arduino documentation here, and a full explanation located here.

Instead of Serial.print("string") use Serial.print(F(string")).

Download the file and copy it into the Arduino IDE.

Open the serial monitor and set the baud rate to 115200.

Step 5: Linux PC Program

This is the code for a Linux PC. It is the same as the code for the RaspberryPi but with the GPIO and wiringPi setup code removed.

Download the file and compile the code with the command: gcc -o 555CalcPC 555CalcPC.c

And run it with the command: ./555CalcPC

If you are not running Linux and you have a C compiler you can probably compile this code . The clrscr() function will need to be changed to the way you clear the screen.

Step 6: Using the Program

The programs let you try out different resistors and capacitors in a simulated 555 timer circuit.

The first picture shows what it looks like in the Arduino serial monitor. The baud rate needs to be set at 115200.

On all versions of the program you will first be asked which circuit to run, then you will be prompted for the resistor and capacitor values. When the R/C values are complete it will display the timings these values will produce in a 555 timer circuit.

At this point the Linux PC program will display the results for twenty seconds, long enough for you to read the results, then return to the main menu.

The RaspberryPi and Arduino versions then wait for you to push the button on the breadboard.

The green LED indicates that the output pin of the 555 is high, and red indicates low.

.

The astable oscillator starts with both LEDs off and when the button is pressed the lights will blink like they would on a 555. Pressing the button again will end the simulation and return to the main menu. If the high time or the low time is greater than 30 seconds they will switch at 30 seconds. Any more than that will get boring. The second picture is a diagram of the circuit that is simulated.

.

The mono-stable simulation shown in the third picture starts with the red LED on indicating the the 555 output is low. When the button is pressed the green LED will light for the correct amount of time. A second press will re-run the simulation. The simulation can be ended at any time by holding down the button for one second.

Great idea !!!
<p>The idea came from a comment by Electronerd on this instructable:</p><p>https://www.instructables.com/id/555-Timer-Emulator-for-Arduino/</p>
<p>If you liked this please consider voting for me in the Digital Life 101 and RaspberryPi contests.<br><br>And please check out my collections:<br><br><a href="https://www.instructables.com/id/555-Timer-Circuits-1/">https://www.instructables.com/id/555-Timer-Circuits...</a><br><a href="https://www.instructables.com/id/RaspberryPi-1/">https://www.instructables.com/id/RaspberryPi-1/</a><br><a href="https://www.instructables.com/id/Beginning-Arduino/">https://www.instructables.com/id/Beginning-Arduino/</a></p>
<p>A big thank you goes out to whoever posted a link to this instructable at:</p><p><a href="http://www.lastminutegeek.com/english/35/1640644-555-timer-calculator-for-raspberrypi-arduino-or-a-linux-pc.html">http://www.lastminutegeek.com/english/35/1640644-5...</a></p>
<p>Thank you Jesse Geekman for posting a link to this instructable at:</p><p><a href="http://geekingbad.altervista.org/555-timer-calculator-for-raspberrypi-arduino-or-a-linux-pc/">http://geekingbad.altervista.org/555-timer-calcula...</a></p>

About This Instructable

3,594views

77favorites

License:

Bio: Most of my instructables will be tutorials for Atmel microcontrollers, Arduino, or Raspberrypi. I try to show concepts that you can use in your own ... More »
More by JRV31:MoonLight 7400 Quad Nand Gate Simulation RaspberryPi: set-up WIFI in Jessie-Lite 
Add instructable to: