Adding A Timer Feature To This Desk Lamp

timer-lamp

[Steven Mackaay] added a simple user interface that implements a shutoff timer for his desk lamp. His project log comes in two parts, the breadboarding and the actual implementation.

He wanted a few things out of the build. The first is an LED that would help him find the lamp in the dark. The second feature is a shutoff timer with different delay options. To get everything working he used a PIC microcontroller to drive a mechanical relay. That relay switches the mains power to the lamps. Now he uses one button to switch the lamp on and off. The other selects a shutoff timer of one, five, or thirty minutes. Power for the control circuitry is provided by the green wall wart PCB seen in the photo of the electronic guts.

This is a pretty general setup that could be applied to a lot of other mains switching applications. Just connect the logic hardware to some type of relay.

PyMCU Test Project Looks Like A Minecraft Mob

pymcu-controlled-blockhead

Hackaday’s own [Jeremy Cook] has been testing out the pyMCU board and managed to put together an animated block head that looks like it could be a foe in Minecraft. That’s thanks mostly to the block of foam he’s using as a diffuser. The face of the project is a set of LEDs. These, along with the servo motors that move the neck are controlled using Python code which you can glance at after the break (there’s a video demo there too).

We first saw pyMCU early in the year. The PIC 16F1939 offers plenty of IO and acts as a USB connected bridge between your hardware and your Python scripts. Speaking of hardware, the test platform used to be an RC helicopter. [Jeremy] scrapped most of it, but kept the servo motors responsible for the pitch of the rotors. The board makes these connections easy, and the concept makes controlling them even easier. In fact, there’s only about 17 lines of code for the functions that control the servos. The rest is a simple UI built with Tkinter.

Continue reading “PyMCU Test Project Looks Like A Minecraft Mob”

Building Pong For An 8-pin Micro

pong

For playing around with video signals and trying to create a an interesting microcontroller project, you can’t do better than the classic Pong. We’ve seen our share of microcontroller-based pong builds, but rarely have we seen an 8-pin microcontroller recreate every part of the first video game.

[Tim] started his PIC12F1840-based Pong build with just a few buttons for controls and a video output. This in itself is somewhat of an achievement, as [Tim] used all the data memory and every GPIO pin on this small microcontroller.

He had time to optimize his build and ended up adding the bleeps and bloops of the original Pong to his build. He’s got an interesting design on his hands, and also what is probably the smallest Pong clone in existence.

IFF System Keeps You From Shooting Your Friends

IMU

An IFF system – Identification of Friend or Foe – are used by military aircraft in battle situations to determine if another aircraft is being piloted by a fellow aviator or an enemy. For the boots on the ground, friendly fire is generally regarded as a very bad thing, so a few students in [Bruce Land]’s ECE 4760 class at Cornell decided to make a wearable version of an IFF for their final project.

[Wen Hao Lui] and [Aadeetya Shreedhar] broke their project down into two parts: an initiator unit and a receiver unit. The initiator unit sends an encryption key to the receiver unit which, in turn, replies back to say, ‘don’t shoot.’ [Wen] and [Aadeetya] needed to choose between using RF or laser-based communications for the initiator, but the difficulty in acquiring or building a radio antenna with the requisite directionality made a laser the obvious choice.

The receiver unit has eight phototransistors attached to a vest and will reply to the initiator unit via a Wi.232 radio module when the laser illuminates the phototransistors. In the event of an enemy acquiring one of these vests, the project includes a pulse detection circuit that will erase the encryption keys when the wearer’s pulse drops to zero. A bit morbid, but the video after the break sure makes it look cool.

Continue reading “IFF System Keeps You From Shooting Your Friends”

Python Can Be Your Best Friend When It Comes To Binary Math

python-binary-math

If you’re into microcontrollers you know the ability to think and perform math in binary is a must. [Joe Ptiz] has been looking for a way to keep from being distract by the math when coding while still keeping the binary strings in the forefront of his mind. The solution he came up with is to use the Python interpreter as a binary math aide.

We knew that you could use Python to convert between decimal, hexadecimal, and binary. But we failed to make the leap to using it for troubleshooting bit-wise operations. We can see this being especially useful when working with sixteen-bit I/O ports like those found on STM32 chips. For us it’s easy to do 8-bit math in our head, but doubling that is another story.

The image above is one screenshot from [Joe’s] tutorial. This illustrates a few different bit-wise operators given decimal inputs but displaying binary as output. He also illustrates how you can use python to test out equations from C code by first setting the variables, pasting the equation, then printing the result to see if the output is what was expected.

Macro Assembly For AVR Chips

avr-macro-assembly

Here’s an interesting tip that can help improve your ability to write assembly code. In an effort to remove the complexity of assembly code for an AVR project [Quinn Dunki] figured out how to use macros when writing AVR code with the GNU toolchain. Anyone using AVR-GCC should keep this in mind if they ever want or need to pound out a project in assembly language.

If you look at the code snippet above you’ll see two commands that are obviously not assembly; PulseVRAMWrite and DisableVRAMWrite. These are macros that direct the assembler to roll in a hunk of code. But avr-as, the assembler used with this toolchain, lacks the ability to handle macros. That’s too bad because we agree with [Quinn] that these macros make the code easier to read and greatly reduce the probability of error from a typo since the code in the macro will be used repeatedly.

The answer is to alter the makefile to use GNU M4. We hadn’t heard of it, but sure enough it’s already installed on our Linux Mint system (“man m4” for more info). It’s a robust macro processor that swaps out all of her macros based on a separate file which defines them. The result is an assembly file that will play nicely with avr-as.

Her implementation is to help in development of the GPU for her Veronica computer project.

Virtual Chess Uses Glove Controllers

chess-using-glove-controllers

Check out the game of chess going on above. It’s a virtual game where each player uses a glove as the controller. Or course the game board and pieces are missing from this image. They’re displayed on a computer monitor which both players can see.

The hardware rather simple, and we think it would be a great project to challenge your microcontroller skills. Each glove has an accelerometer attached to it, as well as a ring of copper foil on the pointer finger and thumb. One ATmega1284 monitors both gloves. The accelerometer data is used to move the mouse cursor on the screen, while the contacts are used to grip or release a playing piece. The game board and pieces are displayed using MATLAB with controller commands fed to it via a USB connection.

If you’re more into building a mechanized game check out this pair of telepresence chess boards.

Continue reading “Virtual Chess Uses Glove Controllers”