Feed on
Posts
Comments

Category Archive for 'Tinkering'

I recently bought a Rigol DS1052E and have been playing around with the different functionality it has. Eventually I came to the point that I’d like to see what frequency does to various components and wanted to build a voltage controller oscillator (VCO).

358VCO

By using 2 opamps and some passive components we can build a VCO as shown above. But I wanted to make one that was simpler so I looked at the ATtiny25.

ATtiny25 Clockout as VCO

The ATtiny25 has a clock out fuse bit which when enabled, outputs the system clock of the ATtiny but the downside is that you can only run on the internal oscillators when you enable that option. As we do with the SATVL, we can use the 16MHz PLL for our system clock and by modifying the OSCCAL value we can underclock and overclock our ATtiny25 – this is the one VCO method we could use. Download ATtiny25_Clockout

Underclocking and overclocking the ATtiny25 – 10MHz minimum to 33MHz maximum.

ATtiny25 Timer1 as VCO

vco2

But what if we don’t want to overclock our ATtiny25? I didn’t know but you can actually use the PLL as a clock source for Timer1 and we can keep our system clock at 1MHz.

(more…)

Read Full Post »

ultra-1

I was given a Visage Ultrasonic Cleaner to see if I could extend it’s timer settings from the maximum setting of 480 seconds to 960 seconds. An Ultrasonic Cleaner uses ultrasound to create small bubbles in the water and when those bubbles collapse it generates enough temperature and pressure to remove dirt and clean objects.

My first thought was that it would have a single board and that I would have to use an ATtiny to press the buttons in a sequence to turn it on for 480 seconds two times in a row. When I went to turn on the Ultrasonic Cleaner to make sure it was operational, it didn’t work. After shaking it a little bit, it seemed to turn on, so something is loose inside.

IMG_2768

Upon opening it up, we have the single board but no MCU in sight. The components worth mentioning are the relay and 2 transistors (I assume they are due to the B / E marking) with heatsinks.

(more…)

Read Full Post »

Following on from my post on How to use Nokia F-bus to send an SMS message where I used an Arduino to send an SMS message, at the end I mentioned moving to an ATtiny2313A/4313 so that we don’t need to use the Arduino.

usart-1

The ATtiny2313A/4313 features Universal Synchronous and Asynchronous serial Receiver and Transmitter (USART) with the features above. The Nokia F-bus uses 115,200 bps with 8 data bits, no parity bit and 1 stop bit.

usart-2

To use USART we need a clock input, there are 3 clock options – Asynchronous Normal, Asynchronous Double and Synchronous Master. For Asynchronous, the clock is generated from the system oscillator where as the Synchronous option is where we provide an external clock signal input. Using the UBRR register we can dial into the baud rate that we want but it depends on the system oscillators frequency.

(more…)

Read Full Post »

A few months ago I was looking into how to use Fbus with a Nokia phone but didn’t have much luck and instead just wired up the keypad. I decided to revisit Fbus and this time happened to find some AVR code which could send/receive SMS’s so now I’m able to send an SMS using the Arduino and I’ll explain how we do this.

IMG_2674

Before I go any further the 3 resources I used were:
Embedtronics – F-bus packet explanation with some examples of a packet
Avr and nokia3310 interface(sms) project on AVRfreaks – Code for an AVR to send/receive SMS
Gnokii – F-bus documentation and code to run on a computer

Firstly you need a Nokia phone which the F-bus commands are known, the best documentation is available for the Nokia 6110 and derivatives (Nokia 6130, 6150, 6190, 5110, 5130, 5150, 5190, 3210, 3310) – this was found in \gnokii-0.6.31\Docs\protocol\nk6110.txt

305px-Nokia_6150_pinout

I was able to purchase a Nokia 6150 from Ebay for under $20. You can search up the Nokia pinout for your mobile phone – I found the TX, RX and GND for my phone.

(more…)

Read Full Post »

In this video I show how you can use an ATtiny85′s (or any other ATtiny) ADC in differential mode which can be used to calculate the voltage drop on a device that isn’t tried directly to ground, for example, to measure the voltage drop across a shunt resistor to calculate current being drawn.

The differential mode allows for bipolar mode so you can see which input is the positive and negative, you can switch the inputs around in the ATtiny and then use the unipolar differential mode to get the full resolution of 10bits. There are also gain settings which you can enable – 1x or 20x gain.

Download ATtiny85_ADC_Differential_v1.0

Read Full Post »

About a year ago I purchased an ATtiny10 with one of my orders but didn’t get to program it because I didn’t have a programmer and didn’t bother getting one. I was looking at Hackaday – it looks like someone wrote up with an ATtiny10 programmer using the Arduino! You program it by pasting the hex file into the serial window.

If you haven’t seen the ATtiny10 before it’s really small (above is a picture of it next to the ATtiny85) but has minimal features, program space, SRAM, registers and functions. It can run up to 12MHz, has 1KB space, 32bytes SRAM, no EEPROM and an 8-bit ADC.

The majority of users whom use the ATtiny10 seem to use assembly instead of C; some examples of ASM files can be seen on the link above. I wanted to use C on it, however WinAVR which uses avr-libc doesn’t support it so we’ll have to use AVR Studio.

(more…)

Read Full Post »

Fixing an issue with a PIR sensor

Following on from my post outlining the modifications I wanted to make to my alarm system, it seems that one of the PIR sensors has started to play up. I tested the 9V battery which was flat and reading 6V or so.

After replacing the battery, it still seemed to have some problems – when it detected movement, it would keep thinking it detected movement and switching the LED on and off every 4 seconds for about a minute or so (or maybe even longer).

Above is the picture of the PCB for reference. I started measuring voltages and compared it to another PIR sensor but there wasn’t a difference in voltage that stood out.

(more…)

Read Full Post »

Using the nRF24L01 wireless module

I decided it was time for me to play around with wireless communication as I recently purchased a wireless alarm system. I was able to pick up two nRF24L01 wireless modules very cheaply at about $2 each from Ebay.

Some features of this chip are:

  • 126 channels
  • Up to 32 bytes payload data
  • Up to 2Mbps
  • About 12mA current consumption when receiving or transmitting

I found there is a RF24 library for the Arduino and a similar library for the AVR. However after looking through nRF24L01 datasheet it appears that the AVR library version appeared a tiny bit incomplete so I’ve made some changes to the code.

The nRF24L01 modules uses 6 data pins but you can get by with only using 5. There are 4 for the SPI, 1 for the chip enable (CE) which sets the nRF24L01 in listen or transmit mode and an interrupt pin (IRQ) which can alert us when a packet arrives, packet is sent or maximum retries reached. I don’t use the interrupt pin in my example.

In my example, I have the transmitting code running on the ATtiny and the receiving code running on the Arduino so I could easily print the results. We run the nRF24L01 from the 3.3V pin on the Arduino.

(more…)

Read Full Post »

For some time I’ve been meaning to do a new video which covers why using 100% of SRAM can sometimes introduce bugs. I discovered this when I was working on the Nokia 3120 Keypad SMS Sender, the SMS message that I was sending would be cut short and would have weird characters at the end. I loaded up the hex file in AVR Studio 4 and found that the stack was overwriting my variables!

Read Full Post »

I recently received a question in regards to the thermistor formula found on one of the SATL build posts asking how I came about the variables used in the thermistor formula. The thermistor formula and variables I used can be found on the Arduino Playground however it made me think if the formula being used was accurate for the Vishay 10K thermistor I was using.

Below we have the Thermistor function in question in which it converts the ADC value to a resistance value in ohms, applies a formula and convert the result to celsius.

double Thermistor(int RawADC) {
  double Temp;
  Temp = log(((10240000/RawADC) - 10000)); // Minus by 10K as that's the resistor in series with the thermistor
  Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
  Temp = Temp - 273.15; // Convert Kelvin to Celcius
  return Temp;
}
Steinhart–Hart equation

The formula used is called the Steinhart–Hart equation which models resistance to temperature, there is the “full version” and the “commonly used” one. A, B, C and D in the functions below are called the coefficients.
Full version: 1/T= A + B*ln(R/Rt) + C*ln(R/Rt)2 + D*ln(R/Rt)3
Commonly used: 1/T= A + B*ln(R/Rt) + D*ln(R/Rt)3

(more…)

Read Full Post »

Older Posts »