Playing with bit-bang Ethernet on Attiny85

When going down into Ethernet or any other signal, you find that there is nothing more than ones and zeros. So practically any programmable device theoretically can send any information in any format. The only limit is RAM space, speed and signal conditioning. Cnlohr was able to squeeze Ethernet functionality in to small Attiny85 microcontroller. He was able to do so without external circuits – twisted pair was directly attached to microcontroller pins. This is really dangerous way to do, because Ethernet signal this way is forced to be tied to mcu ground. Ifthere is a DC offset in the line, it can cause damage. Normally there is a magnetics involved in signal line.

Anyway this is great hack showing that anything is possible with minimal component count and small processing power. Attiny is clocked at 20Mhz and uses one twisted pair for network connection. IT is recognized as 10MBit Ethernet switch that can send hard-coded packets once one of couple buttons is pressed. To get 10MBit from 20MHz micro thee is an assembly language involved. As it is said, this project is more for playing but strictly not for production as it is dangerous and not reliable.

Few AVR programming tips from ATMEL

Today all C compilers generate very optimal code for microcontrollers. In most cases is not worth trying to optimizing it by writing assembly lines. But there are one factor left that lead to less efficient code – the guy who writes code. If you have programmed for PC writing code same way not always is the best way to do. Microcontroller oriented compilers like AVR GCC is adapted to generate optimal code for AVR devices. If you will go to other micros, then you will see that programming ARM microcontrollers with C in some cases require special code structure to get most of hardware. To be a pro on those things you actually need to know how hardware works in one or in other situation, but simple general tricks may save a day by reducing code size ans so speeding up the execution. Improper coding may generate excess code. So Atmel has prepared an application note where they take through several key coding tips.

avr_gcc_optimize

One part is more dedicated to reducing code size by doing simple decisions on selecting variable types, making them global or local. Then move towards loops, where counter increment and decrement generate different code size. Storing constants in program memory instead of loading to RAM helps saving RAM space. Other part goes to improving execution speed. Simple tricks like loop enrolling, control flow, can significantly speed up your program. Sometimes code space can be sacrificed to gain speed. So it is up to you what you are looking.

Watch with Numitron tubes

DIY digital watches are pretty intensive field among hobbyists. NO matter how many builds you’ve seen, there are always something new and unique. This time Johannes shared his recent project where he is building watch with 7 segment Numitron tubes. They are small enough to fit as displays in to wristwatch. (Video in German)

Watch is controlled by Atmega8 microcontroller which drives tubes through couple TLC6C598 drivers. Watch also includes charging circuit that allows taking care of battery inside. Watch with tubes were placed inside custom 3D printed enclosure which has windows for digits. There are some work left to finish the project – mostly with enclosure and fixing buttons.

Water pool filling timer

Filling tank with water is very boring task. Standing and watching it until it fills up is a waste of time especially if volume is quite big. IT is better to leave this task for automatics. There can be several ways of controlling filling process. One is to use timer which shuts valve after predefined time period. Another method relies on water level sensor which detect when water level reaches some level. Second method is more accurate, but needs more setup. Kyle was asked to construct water filling timer which would turn off valve after some time.

attiny_water_pool_timer

In this setup user starts timer by opening valve. After time runs our, valve is shut. So user has to determine the time needed to fill pool with water and program this value in to controller. Of course things can happen, for instance water pressure drop what would lead to underfill. Despite this, system works great and reliably. Controller is built around Attiny microcontroller which accepts start input via single button. Valve is controller by using TLC226T TRIAC which drives 24V solenoid. Couple LED indicators indicate timer status. The nice thing about this controller, is its enclosure which was 3D printed. It looks great, it has it connectors populated for convenient wire attachment.