‘Hello World,’ Raspberry Pi Style – InApps is an article under the topic Software Development Many of you are most interested in today !! Today, let’s InApps.net learn ‘Hello World,’ Raspberry Pi Style – InApps in today’s post !

Read more about ‘Hello World,’ Raspberry Pi Style – InApps at Wikipedia



You can find content about ‘Hello World,’ Raspberry Pi Style – InApps from the Wikipedia website

Last week we covered a simple input interface to a LibreOffice Impress slideshow using a couple of general purpose input/output (GPIO) pins on the Raspberry Pi.

This time, we’ll look at the output side with the traditional “Hello, World” program of microcontrollers and Nanolinux devices, blinking an LED. In our case, we’ll actually light up an LED with Python. The LED is housed in an old up-cycled stove-hood bulb and gives an interesting Steampunk “ozone tube” effect. Graphic 1 shows the tube as part of my Steampunk name badge. The LED is hooked up to the Pi using a 40-pin connector salvaged from an old PC hard-drive cable.

Graphic #1 - Ozone tube on the Steampunk Conference Badge

Graphic 1: Ozone tube on the Steampunk Conference Badge

Throughout this series, I’ll encourage budding hardware hackers to learn new skills and try new things.

One important skill is getting into the habit of collecting parts. I use various bins and storage containers to collect screws, bolts, washers, nuts and other kinds of small hardware. Another bin might contain old circuit boards. Another might hold Steampunk parts like old gears, watches, copper fittings, brass hinges, and so on. You get the idea. With a well stocked “junk box”, getting that perfect “look” for some one-off, attention-grabbing project is just so much easier.

Building An “Ozone Tube”

I build projects to support my tech conference speaking habit, frequently using a Steampunk theme. The “ozone tube” was built from an old up-cycled stove-hood bulb and creates an old-timey, scientific aesthetic.

The first step is to clean out the bulb.

Read More:   Which Will be the Top SAAS Companies in 2022?

Use a grinder or side cutters to remove the center solder spot and glass insulator on the socket end of the bulb. Don’t remove the entire metal screw part of the bulb, because it makes it much harder to get everything solidly back together.

Next, use a small screwdriver to gently break the glass filament support out of the inside of the socket end, trying not to damage the bulb part. I used a leather glove to hold the bulb, so I wouldn’t cut my hand, just in case. Use long-nose pliers to crack and pull out parts of the glass center support. Once, the filament is out, you can use a little carbide burr, in a Dremel tool, to enlarge the hole. You’ll need a big enough hole to slide the LED into the glass envelope.

The LED has four leads, three that go to digital input/output pins on the Raspberry Pi and the other one that goes to ground. I soldered a 100 ohm resistor between each LED lead and GPIO pin wire to limit the current to about 20 milliamps. The LED was then glued to a sliver of quartz to create a Steampunk “radioactive ozone crystal.” Graphic 2 shows the “crystal,” resistors and support tube.

Graphic #2 - LED, resistors and support tube

Graphic 2: Crystal, LED, resistors and support tube

The whole works are then attached to a little brass tube and inserted into the hollowed out glass bulb. It’s easy enough to fashion a bracket for the bulb out of 1/4-inch wide brass flat stock and some small screws. The wires lead to the 40-pin connector. See graphic 3 for the wiring diagram.

Graphic #3 - LED wiring diagram

Graphic 3: LED wiring diagram

Once the ozone tube is ready, we can turn our attention to lighting it up.

Light the Tube with Python

Controlling output pins on the Pi is much the same as reading input pins. Here’s a small Python program I modded from a script by Alex Eames at RasPi.tv.

The program begins with referencing the libraries and initializing the general purpose input/output (GPIO) pins connected to the LED. In this example, I just used the color blue to keep the script simple. Change the pin number to activate the red (GPIO 22, pin 15) or the green (GPIO 27, pin 13) segments of the tri-color LED.

Read More:   Measuring User Experience in Modern Applications and Infrastructure – InApps Technology 2022

I chose to start the blue LED at 25 percent brightness and set the LED change rate at 0.2 seconds.

Next, a loop starts that steps the LED down and up through its duty cycle.

Lastly, if we get a from the keyboard, the program resets the GPIO pins and exits.

What’s Next

Now you have one example of pulsing an LED up and down with a Raspberry Pi. Varying the on and off time, as well as speed, will give different effects. The frequency (100 Hz) is slow enough that the blue light flickers slightly, which is perfect for my “radioactive ozone crystal” Steampunk effect.

You could also control a motor through a motor driver circuit, close a relay to handle a bigger electrical load, or even run servos.

Next week, we’ll do a quick tutorial on soldering.



Source: InApps.net

Rate this post
As a Senior Tech Enthusiast, I bring a decade of experience to the realm of tech writing, blending deep industry knowledge with a passion for storytelling. With expertise in software development to emerging tech trends like AI and IoT—my articles not only inform but also inspire. My journey in tech writing has been marked by a commitment to accuracy, clarity, and engaging storytelling, making me a trusted voice in the tech community.

Let’s create the next big thing together!

Coming together is a beginning. Keeping together is progress. Working together is success.

Let’s talk

Get a custom Proposal

Please fill in your information and your need to get a suitable solution.

    You need to enter your email to download

      Success. Downloading...