Somewhat unrelated to the vactrols, I decided to sit down and try to figure out how the hell to program the attiny's.
Good news is I got it working!
Great news is the attiny85 that I thought I fried is doing the thing!
seen from Russia
seen from United States

seen from Canada

seen from United States

seen from Malaysia

seen from Canada
seen from Canada
seen from Germany
seen from Türkiye

seen from United States
seen from United States

seen from United States

seen from Germany

seen from United States
seen from Malaysia
seen from China
seen from France
seen from Türkiye
seen from Australia
seen from China
Somewhat unrelated to the vactrols, I decided to sit down and try to figure out how the hell to program the attiny's.
Good news is I got it working!
Great news is the attiny85 that I thought I fried is doing the thing!
First ATTINY85 project!
(warning: video has actual flashing LED lights)
[ Video ID: A breadboard with a Blue LED on top of an 8-pin DIP Integrated Circuit on it. The Blue LED is flashing rapidly. There are other components on the breadboard in the background. End ID ]
Last week I bought some ATTINY85 Microprocessors to experiment and work with :) With my W65C02 project on hold until I can afford an oscilliscope, and my Radio project delayed because I can’t quite figure out how to reverse engineer the 8 pins on the volume knob, I wanted something else to work with. I’ve been wanting to mess with Atmel microprocessors (Arduino Uno runs on an Atmel ATMEGA328), and now’s a good chance!
I’m jumping straight to assembly with the ATTINY85; I don’t know any C/C++ code, and also I’m familiar with other processor Assembly languages, so I might as well. And other than different names for functions, it’s been pretty easy so far! Something I’m not used to is that this processor, despite being pathetically tiny, has 32 registers; I’m used to working with 8 Max.
Anyways, for the code explanation: When the processor first starts, it turns on PINB0, which is physical pin 5 on the processor. Then, after counting to 256 256 times, it turns off PINB0 for another 256^256 counts. I’m away from home while writing this, so my notes arn’t here, but if I remember correctly it came up to 200k microseconds? That adds up to about 400 nano seconds per on/off cycle, or 2.5 flashes per second. I can add in another loop to make it last longer, but before I do that I’d like to look about to see if there’s a smarter way to tackle this.
My next step after this, is to figure out how to get this processor to read digital inputs: My next project is to finally do something with my box of telephone rotary dials. I already have one spec’ed out for breadboard testing. I would LOVE to show it, but Tumblr has a One Video Per Post limit :(
In the past few weeks I’ve built a model railroad signal for garden railways with a custom DCC decdoder. Here’s what it looks like:
I’ve heard from a number of people that they thought this was interesting, but they didn’t really understand what I was doing. So today I’ll try to explain the core of it all, this circuit board:
And here’s the associated circuit diagram:
I’ll try to explain why this is the way it is and what it does.
(This whole explanation is aimed at people who have never done anything with electronics before. If that’s not you, then this may be a bit boring. Also, I didn’t come up with any of the parts of this. Most of this is based on things I learned by reading OpenDCC and Mikrocontroller.net. I’m sure I still made a lot of mistakes, though, and they’re definitely all mine and not the fault of anyone on these sites.)
The goal
First let’s talk about requirements. My goal was to build an american signal type “Searchlight”. Such a signal has between one and three lamps. Thanks to a clever electromechanic design that moves different color filters around, each lamp can show different colors - up to three from a total selection of four.
Replicating this system for a model railroad is not practical. I need something else. Having multiple colored LEDs next to each other wouldn’t work; they’re too big and I want it to all look like one light source. There are LEDs that contain red, blue and green in one housing, but that would require a lot of wires quickly that all have to be put in the mast. The solution is this:
This is an “adressable” LED, better known under the name “Neopixel” used by a large american online store. There are many variations from different manufacturers. The key thing is that each LED has a tiny control circuit built right in. It takes four wires: Plus five volts, minus, data in and data out. If you have more than one, you can connect the data out of the first directly to the data in of the second and so on. Connect the plus and minus as well, and you can control almost unlimited amounts of LEDs with just three wires.
The data line has a special protocol that you need to generate. Basically you need to switch it from 0 to 5 to 0 volts again and again at a certain rate; the time it stays at 5 volts (“high”) determines whether you’re sending a 0 or a 1. From these bits you form bytes, which tell each LED what specific color value to send.
Due to this dataformat, you definitely need some electronic circuit controlling the signal, and the first requirements for this are:
Provide five volts DC power
Generate the data for the LEDs in the correct format
The Input
There are a lot of options for designing the input side of things. In my case, I’m assuming the signal is electrically connected to the rails of a model railroad that is controlled digitally. With digital command control (DCC), the voltage at the rails has a constant value of about 15 to 25 volts, larger for larger scales. This voltage constantly flips polarity; first plus is on the left rail, then it goes to the right rail (and minus vice versa), and then back. It’s like AC in normal wall outlets, but with very abrupt changes instead of a smooth sine wave.
This voltage has two tasks. First it supplies the locomotives with power, but it also transmits information. If one of these change-and-back sequences is long, it transmits a “0”; if it’s short, it transmits a “1”. These bits together then form the bytes that form the messages that say things like, “Locomotive three run at speed step 64” or “switch 10 switch to direction left”.
This decoder uses both features. The digital voltage provides both the data and the power. For a locomotive, that is required since the only conductors you have are the rails. This is a stationary decoder, so I could have designed it so that it only uses digital commands, and gets the power from an external power supply. However, I wanted to use the least amount of cables, so I’m using the simple version.
With that, the requirements are fixed. The circuit has to:
Turn the digital power (15-25 Volts, AC-ish) into 5 Volts DC
Read and understand the digital data signal (decode it, hence the name “decoder”) and calculate the colors for the LEDs.
Computation
This calculation is the real key here. The digital signal has a completely different fromat than what the LEDs expect. It’s slower, but also has completely different meaning. At best it transmits “set switch or signal 10 to state 0”. Which color values are associated with that, let alone any blending to make it look nice, are things the signal has to decide for itself. There is no way to build a simple stupid adapter here; I need a complete computer.
Luckily, you can get those for cheap and in really tiny.
The ATtiny85 costs about 1€ depending on how many you order, and it’s smaller than one cent coin (I think in basically any currency), but from a technical point of view, it is essentially a full computer. It has all the important parts anyway. There is a CPU that can run at (depending on the version) up to 20 MHz; half a kilobyte of RAM and eight kilobyte of internal storage for the program. Multiple programs is a bit of a challenge. If you know Arduinos, the ATtiny85 is related to the ATmega328p in the Arduino Uno and Nano. Far less powerful, but cheaper and significantly smaller.
What it lacks are all the surroundings like keyboard and screen for input and output. The chip is designed for applications where this isn’t needed, or at least only minimal things. The software that you write can assign each pin (okay, five out of eight) freely for different tasks: The pin can work as an input, telling the software whether there’s a low or high level of voltage at it (meaning 0 or 5 Volts), or it can work as an output and write high or low values, meaning setting the pin explicitly to 0 or 5 Volts.
There are other options for the Pins as well; among other things it can also read analog voltages and generate them to some extent. But for this task I only need the simple digital high-low inputs and outputs.
These types of chips, known as microcontrollers, exist in thousands of variations by different manufacturers with very different performance characteristics. They are the key part of basically everything that’s digitally controlled these days. Washing machines, everything that plugs into a computer including every single Apple lightning cable, TVs, TV remotes, amazing amounts of parts in cars and so on are all the realm of microcontrollers. The ATtiny85 is, as the name implies, very much at the low end of the scale (though there are smaller ones), and even here, it is a bit out of date. But it is very easy to program and very forgiving of mistakes, which makes it great in hobby situations.
To run, this chip needs around 3-5 Volts DC (some versions like the one here can also run on a bit less) and exactly one capacitor. I’m already generating 5 Volts DC for the LEDs anyway, so this chip will get them as well. That means for all the calculation, only two pieces of hardware are required.
There is some more associated hardware, though, for getting the program (which I’ve written myself) on the chip. For that you need a programmer, a device that you can buy for some money, or make yourself astonishingly easily from an Arduino. It needs to be connected with six wires to the chip. The standard for this is with a six-pin plug, which I’ve thus included here as well. There are standard six-wire cables for this.
You could connect the cables differently, for example with some sort of spring-loaded contacts on some programming circuit board you’d have to build for that, or in the worst case, just temporarily solder the cables in there. But the plug version is both simple and convenient, with the only downside that it makes the circuit a bit more pointy.
(Due to the Tumblr image limit, the next part will have to be in a reblog)
“When your 60% doesn't have an escape key“ via u/DanRoad on reddit
explanation in the thread
The Fire Proof Birthday Candle
This week we celebrated the first birthday of my youngest son, Luca. So it is time for him to blow out his first candle. Of course you can't trust a one-year-old to not set the house on fire when handling a candle, so of course we need to solve this with some electronics.
It took a few tries, but I was finally able to get successful test my ATtiny chip! Thanks @arghuino for the assist! . . #stem #stemeducation #stemedu #stemkids #podpi #arduino #arduinouno #c #codinglife #coding #korea #codingheroes #attiny85 #breadboards #led #programmingisfun (at Busan, South Korea)
Made a handy little Development platform for the ATTINY85, so I can finally finish my exploding cyber-zombie head for Halloween.
The ATTiny85-20PU is an 8-bit microcontroller with an 8KB of program memory. It has six general-purpose input-output pins that can also be programmed to act as ADC pins, PWM pins, SPI port, or I2C port. The ATTiny85-20PU has 512 bytes of EEPROM that can be used to store data that are rarely chang...