Tag Archives: AVR

AVR basics: Using cheap ultrasonic rangefinders

As part of my cunning plan to develop ‘smart’ sensors, I’ve been playing around with infrared rangefinders (and may do a post on those soon). But the first kind of rangefinder I ever tried was the ultrasonic type, so it was time to reacqauint myself. And, in particular, I wanted to see if I could do this on the cheap…. Read more »

AVR basics: reading analogue input

It’s an increasingly digital world, but not all information comes packaged neatly in 1s and 0s. Sometimes you have to deal with analogue voltage levels using the microcontroller’s analogue to digital (ADC) converter. Measuring analogue voltages is made easy in Arduino projects because the IDE comes with a handy analogRead() function. Providing your input voltage does not exceed what the… Read more »

Sheldon robot: smart sensors

      No Comments on Sheldon robot: smart sensors

Microcontrollers can be busy little beasts. That’s because we load them down with jobs to do  – sometimes too many jobs. In the main loop of an Arduino, AVR or whatever microcontroller takes your fancy, we often spend time polling sensors and then throwing away the data as uninteresting. On the robots I’ve built in the past, for example, that polling… Read more »

DottyMatrix: a simple solution?

The DottyMatrix project began when I thought, ‘It would be nice to make use of my old Epson MX-80 F/T III dot matrix printer’. The problem was talking to it. But then I thought, ‘It’s just parallel printer interface. I’ll make a microcontroller-based device to act as an interface. How hard can that be?’. The answer, it turns out, is… Read more »

DottyMatrix and Virtual Printer – together at last

It’s great when a plan comes together. Having independently played around with my DottyMatrix serial-to-parallel printer interface and the Virtual Printer (designed to simulate my still-dead Epson MX-80 F/T III dot matrix printer), it was time to hook them together. And it worked! On the left is the DottyMatrix using my prototyping board for the ATMEGA328PB microcontroller. Its serial port… Read more »

Virtual printer & more fun with AVR interrupts

In building my AVR ATMEGA328P-based ‘virtual parallel printer‘, there were two signals that required special treatment. So it was time to revisit interrupts. On a Centronics-style parallel port, the host machine sends an ‘init’ or reset signal to the printer to tell it to flush its buffers and set itself to the default state. It also sends a ‘strobe’ signal… Read more »

Building a virtual parallel printer

Here’s a tip for anyone building a device designed to interface with a parallel printer – you kind of need a parallel printer to test it on. That shouldn’t have been a problem. My DottyMatrix project – which will allow me to send data over a serial connection and have it printed on my Epson MX-80 F/T III dot matrix… Read more »

Making tools #2

      No Comments on Making tools #2

Some time ago, I wrote about how I’d hacked together a board to program and experiment with AVR ATMEGA328P microcontrollers. Well, now I’ve stepped things up a bit. Mk.II The key features of the old board were a ‘zero insertion force’ (ZIF) socket for the microcontroller chip and a 2×3 HE10 socket to take the ISP cable from my programmer… Read more »

AVR basics: using the I2C bus #5 – final thoughts

Part 1 – bit rate Part 2 – transmitting Part 3 – sending data Part 4 – receiving data Part 5 – final thoughts The I2C bus isn’t that hard to use and for most applications it’s pretty simple. However, there is a lot more depth to it than we’ve covered here. The purpose of this final post in the… Read more »

AVR basics: using the I2C bus #4 – receiving data

Part 1 – bit rate Part 2 – transmitting Part 3 – sending data Part 4 – receiving data Part 5 – final thoughts This builds on the previous two posts that dealt with the fundamentals of sending data over the I2C bus on AVR microcontrollers and then how you actually do it. Receiving is a similar process, except for… Read more »

AVR basics: using the I2C bus #3 – sending data

Part 1 – bit rate Part 2 – transmitting Part 3 – sending data Part 4 – receiving data Part 5 – final thoughts In part 2 we looked at the fundamentals of how data is transmitted over the I2C bus. Now let’s actually do it. And, as usual with AVR microcontroller stuff, it’s all about registers. As before, our… Read more »

AVR basics: using the I2C bus #2 – transmitting

Part 1 – bit rate Part 2 – transmitting Part 3 – sending data Part 4 – receiving data Part 5 – final thoughts So in the first post in this series, we looked at how to configure the bus speed for I2C. Now we’ve got that out of the way, let’s start sending stuff over the bus. The I2C… Read more »

AVR basics: using the I2C bus #1 – bit rate

Part 1 – bit rate Part 2 – transmitting Part 3 – sending data Part 4 – receiving data Part 5 – final thoughts When I first started playing around with Arduinos I quickly grew to like the I2C bus, and for a couple of good reasons. First, it was easy to use. And second, there are lots of fascinating… Read more »

AVR basics: SPI on the ATMEGA – Part 2

In Part 1 we got the SPI bus set up on an AVR ATMEGA328P microcontroller. Now let’s start using it. Settings pins Before we get going, we need to set up the pins for the SPI bus on the AVR (which we’re using in master mode). I’m using the ATMEGA328P here, so I’m going to define some macros to make… Read more »

AVR basics: SPI on the ATMEGA – Part 1

When it comes to getting devices to talk to each other you’re spoiled for choice. There’s good, old-fashioned serial via UARTs, I2C (which I like a lot) and what is rapidly becoming my new favourite, the Serial Peripheral Interface (SPI). So let’s take a look at that. [Quick side note: please remember I don’t claim to be an expert. I’m… Read more »