---

Showing posts with label attiny. Show all posts
Showing posts with label attiny. Show all posts

Tuesday, April 10, 2012

Steampunk FM Radio - Part 2

In my last post I looked at the finished project.

Update: Monkmakes.com now selling a breakout board for the TEA5767 that simplify things a bit: http://www.monkmakes.com/#!/~/product/category=0&id=36087884


I don't think I would recommend building it the way I describe here. There are a few unsatisfactory things about it. Mainly its difficult to tune - the pot tends to drift a little. Perhaps a vernier dial, or better a rotary encoder. It could also do with a pre-amplifier - the output from the TEA5767 just isn't that high. As a receiver, its also not that sensitive and needs a better antenna than the 2ft of solid core wire dangling out the back that I gave it. Although to be fair I live on the wrong side of a hill for good FM reception,

Anyway, because I don't like to see projects without any details given of how they work, here it is, help your selves and may it inspire you to do it better.

It uses the amp and speaker from a scavenged PC USB powered speaker (right hand side) the TEA5767 module and breakout, described in an earlier post, and a small ATTiny45 board, that has ICSP connector and a 7805 voltage regulator - from another project.

Tuning is accomplished by turning the pot read by an ADC on the ATTiny. This then maps to a frequency that is sent to the TEA5767 by I2C.

The ATTiny is programmed using the Arduino IDE as described here http://hlt.media.mit.edu/?p=1229

It uses the TinyWireM library to the I2C communications. Note you will need to change the header TinyWireM.h to 8MHz instead of 1. See the instructions on the link above.

Here is the script:


#include <TinyWireM.h>

const int potPin = 3;

unsigned char frequencyH = 0;
unsigned char frequencyL = 0;

unsigned int frequencyB;
double frequency;

void setup()
{
  TinyWireM.begin();
  frequency = 97.4; //starting frequency
  setFrequency();
}

void loop()
{
  int reading = analogRead(potPin);
  frequency = map((float)reading, 0.0, 1024.0, 87.5, 108.0);
  frequency = ((double)reading * (108.0 - 87.5)) / 1024.0 + 87.5;
  frequency = ((int)(frequency * 10)) / 10.0;
  setFrequency();
}

void setFrequency()
{
  frequencyB = 4 * (frequency * 1000000 + 225000) / 32768; 
  frequencyH = frequencyB >> 8;
  frequencyL = frequencyB & 0XFF;
  delay(100);
  TinyWireM.beginTransmission(0x60);   //writing TEA5767
  TinyWireM.send(frequencyH);
  TinyWireM.send(frequencyL);
  TinyWireM.send(0xB0);
  TinyWireM.send(0x10);
  TinyWireM.send((byte)0x00);
  TinyWireM.endTransmission();
  delay(100);  
}



About the Author
These are my books. Click on the image below to find out more about them.




Friday, February 10, 2012

Snootlab Zombadge

If you want a nice simple board to solder up for fun, or just to learn a bit of soldering, then you might like to consider a Zombadge Kit from Snootlabs. They are kind of fun!


They come as a complete kit, with a lithium cell that fits in a holder on the back.

The instructions for building the kit are clear and simple, in Snootlab's usual photo-cartoon style. They also tell you how to identify the components.

For novices, the RGB LED is a little tricky to solder as the leads are close together, so check for solder bridges when you are finished.

The badge is powered by an ATTiny85 microcontroller fitted in a DIL socket. It has an RGB LED (left) an IR sender and an IR receiver as well as ICSP programming headers.

The ATTiny comes ready programmed and when you turn the badge on, it cycles the LED through its colors.

There are some instructions on installing various games on it here. Theses instructions are mostly in French, with an abbreviated version in English, but I had to refer to the French version to try and see what was going on. Better game translation please Snootlabs.

If you have a number of these badges, you can play some interesting interactive games.

Sadly I only had one, so I had to make do with a flashing LED.

The boards are designed to be programmed using an Arduino as an ICSP, and there are instructions for doing this (in English). Unlike the approach of Hi Low Tech, you do not use the Arduino IDE to program them, but rather run 'make' files after configuring them for the port to use.

I wanted to try programming the boards using the Arduino IDE and a USB Tiny ISP as I have with some home made ATTiny boards, but All I could get was:


Binary sketch size: 658 bytes (of a 8192 byte maximum)
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.



The schematic for the Zombadge is available on the downloads tab of the product page.

I would be interested to see if anyone gets any further with this. I can see some interesting hacks for this gadget, along the lines of TV be Gone!

Anyway - irrespective of my failed attempts to hack it, this is a nice little gadget!

About the Author
These are my books. Click on the image below to find out more about them.


Friday, January 6, 2012

Canine Radio Direction Finder - Part 2

Its been a long time coming, but my son Matt and I finally finished the radio direction finder project. I described part 1 (the transmitter back in November 2011. This post describes the receiver.




The basic idea is that the transmitter sends beeps and you turn the directional antenna until you get maximum signal and that is the direction of the transmitter.

It doesn't work terribly well. The reason being the antenna is quite sensitive, so even though it is directional, if the transmitter is close then you cant tell which way it is. So it only works in the sweet spot where the transmitter is far enough away for the signal to be smaller when the the antenna is pointing the wrong way but not so far away that you cannot get a signal at all. For us, this range was perhaps 30 to 100 yards.

What is really needed is some means of varying the gain of the antenna. We ran out of enthusiasm before solving this problem.

Anyway, it does work after a fashion and its quite fun and cheap to make.

This is the schematic.



Its just an audio amplifier that amplifies the signal from the RF module. The module is the other half of the transmitter module and something like this. Make sure you get an AM module - that matches the frequency of the transmitter.

If you want to use a speaker, omit R3, but we found headphones better. So in the diagram above the speaker is actually a headphone socket.

The directional antenn is made from a piece of wood, with lengths of retractable steel ruler attached to it. The design was taken from a posting on an Australian forum that I now cannot find. But I'm sure they wouldn't mind my repeating it here.



The second element takes the connection to the receiver circuit and this is made with a short length of TV antenna lead.

You can also see how the strips of ruler are just screwed onto the wood.

As I mentioned the results were a little disappointing. But then the whole project cost about 20 USD and we had some fun. Especially wandering around the neighbourhood wearing headphones and clutching what looks like a home made TV antenna. This is the kind of situation where it is best to just to cultivate a wild look in the eye and hope people don't bother you or call the police.
About the Author
These are my books. Click on the image below to find out more about them.


                                                                                                                           

Sunday, November 6, 2011

Canine Radio Direction Finder - Part 1

After our new dog ran off when we were out, I decided it might be fun to make a radio direction finder, so that we can at least see in which direction he is.


So far, I have made the radio transmitter end of the project. In the second part of this blog I will look at the receiver and the directional antenna.

The transmitter is built using a low cost 433MHz AM Radio Frequency transmitter module. This is the module that I used RF SOLUTIONS - QAM-TX1 - MODULE TRANSMITTER AM 433MHZ but theses modules are pretty standard in their pinouts and features.

To provide pulses to the RF transmitter, I use an ATTiny45 programmed using an Arduino board as described here: http://hlt.media.mit.edu/?p=1229



The pulses are are a continuous series of 'Sputnik-style' beeps at a frequency of 300Hz.

The 3.7V battery and tiny slide switch were scavenged from a broken RC helicopter and the antanna is made by wrapping 17cm of solid core wire around a screwdriver.

To test out the transmitter, its corresponding 433MHz receiver module (RF SOLUTIONS - QAM-RX2 - MODULE RECEIVER AM 433MHZ) was fitted to some breadboard and an oscilloscope attached.








So there we go! We are receiving the signal. The next step is to build a directional antenna with ajustable gain, so that by sweeping it back and forth we can find the point of maximum signal strength.

The sketch:


int pin = 3;


void setup()
{
  pinMode(pin, OUTPUT); 
}


void loop()
{
  beep();
  delay(500); 
}


void beep()
{
  for (int i = 0; i < 100; i++)
  {
    digitalWrite(pin, HIGH);
    delayMicroseconds(200);
    digitalWrite(pin, LOW);
    delayMicroseconds(200);
  }
}

About the Author
These are my books. Click on the image below to find out more about them.