Last entry: 2012-09-11 21:41
38 entries written
446 comments have been made
23 visitor(s) this month
1 visitor(s) today
3 visitor(s) this week
11 visitor(s) online
Thursday, February 2. 2012
Even lazier ICSP programming Posted by Fanjita in Arduino at 23:00
The previous post discussed my gradual drift to using a dedicated ICSP programmer to reflash AVR chips. This post describes how to make useful ICSP slave boards, to make life easier yet.
First up, some pinouts. I'm mostly interested in the 6-pin ICSP header, and the ATTiny85 (absolutely tiny, not many I/O pins), ATTiny2313 (a bit bigger, tiny memory, but built-in UART and more I/O pins), and ATmega328 (as used in Arduino). These are all drawn on a Mac in "Shapes", by the way. Another experiment, and it seems OK for basic diagrams, if a little buggy. £2.99 from the App Store.
I've only marked the pins that are important for ICSP. Connecting one of these up to an ICSP header is trivial - just connect the corresponding pin labels together between the ICSP header, and an IC socket. Notes:
Ah - but see how a lot of the pins are all in roughly the same place and order? Well, I wondered if you could connect up a single socket in such a way that it can be used to program any of these 3 chips? Luckily, we can! Continue reading "Even lazier ICSP programming"
Thursday, February 2. 2012
Making it easy to program an ATTiny Posted by Fanjita in Arduino at 22:15
Larry Wall once said that laziness is one of the 3 main virtues of a programmer. I guess that makes me a great programmer... Anyway, this post describes my ongoing quest to make programming an ATTiny as painless as possible, something that I seem strangely driven to achieve.
First, a note of explanation of the technique behind all of this. AVR chips include functionality called In Circuit System Programming (or ICSP, sometimes shortened to ISP). In essence, this allows the non-volatile memory on the chip to be reprogrammed at any time, even when it's already embedded in a circuit. ICSP works by holding the /RESET line low, which disables the normal operation of the chip, and then manipulating some special data lines to effectively communicate with an in-built primitive bootloader. AVR sell a number of programmer boards that implement ICSP, but they can be quite pricey (~ £50). All modern Arduino boards include a 6-pin ICSP header, clearly labelled, which allows your Arduino to be reflashed in situ, if you have such a programmer. To avoid confusion, I'm going to refer to the device that is generating ICSP control signals as the ICSP master, and the device being programmed as the ICSP slave.
The cheapest way to start programming any AVR chip, assuming that you have an Arduino already, is to use the Arduino as an ICSP master, using a sketch that simulates one of AVR's branded boards. This is all documented very well here.
Important note: The ArduinoISP sketch delivered with Ardunio 1.0 is broken. The easiest solution is to install Arduino 022 alongside your 1.0 installation, and follow those instructions (rather than the 1.0 instructions on the same site).
That works pretty well, but there are drawbacks:
Surely we can do better than this... Continue reading "Making it easy to program an ATTiny"
Tuesday, January 31. 2012
Automatic USB disconnector Posted by Fanjita in Arduino at 23:30
I use a Linux box with a cheap (but extended-range) bluetooth dongle to monitor the invertor for my solar panels, and also my central heating monitor. This is fine, except that occasionally the bluetooth dongle seems to crash, and it needs to be physically unplugged to recover. Since there doesn't seem to be any comprehensive way to do this through software (you can reset the device, but it doesn't perform a power interruption so doesn't recover it sufficiently), I decided to make a little hardware dongle to do it for me.
The design is extremely simple - just use an ATTiny to periodically (perhaps once a day) interrupt the 5V USB line. All other USB lines (data +/-, GND) pass straight through. Rather than power the attached device directly from an ATTiny I/O pin (which can only source ~40mA) I drive the attached device's power line through a PNP transistor (in this case rated at ~ 200mA, which is enough for my purposes, but 500mA would be needed for general purpose USB loads). Continue reading "Automatic USB disconnector"
Monday, January 30. 2012
Wavetable synthesis with an ATTiny45/85 Posted by Fanjita in Arduino at 23:20
Here's something to aspire to - being able to wring miracles out of the ATTiny as well as this guy: Electronic Lives Manufacturing.
Using just an ATTiny45 and a loudspeaker, he's able to produce a full, polyphonic musical box using wavetable synthesis, capable of playing tunes with over 300 notes. It's a far cry from those musical greetings cards inserts, which are usually just monophonic square wave tone generators and a piezo transducer.
To achieve the necessary speed and compactness (just 4KB of flash space), it's all written in AVR assembler. I'm not sure I've got time, or room in my head, to learn yet another assembler instruction set, but this is certainly some pretty serious inspiration to get the most of these amazing little chips.
Given that I've got ATTiny85s, with double the flash space, I'd quite like to tinker and add some simple extra functionality to this (e.g. deep sleep mode, playing one cycle of the tune for each press of the reset button; and my own choice of tune) but that might have to wait a while.
Sunday, January 29. 2012
Instrument Tuner - Zero Crossing ... Posted by Fanjita in Arduino at 00:30
Having captured audio over a microphone, and converted to a voltage suitable for the Arduino ADC, the next challenge is capturing the analogue data and converting it into an estimation of the frequency of the current note being heard. That's a fairly tricky problem, as it turns out.
Firstly, the default Arduino analogRead() function is way too slow. At 100 microseconds per read, that's a maximum sample rate of 10kHz - and even that is only possible when tight-looping doing reads, and nothing else. According to Nyquist's theorem, at a bare minimum I need to be able to sample at at least twice the highest note's fundamental frequency, which is probably going to be about 1kHz, so double up to 2kHz. I'd ideally like to sample at least 5-6 times the highest fundamental, and calculating the incoming frequency requires some maths too. So, I decided to look into alternative approaches.
A naive approach to frequency counting is to count zero-crossings in a given direction - i.e. observe the waveform, and everytime it goes from negative to positive, increment a counter. Counting the number of crossings in a given time directly gives you the frequency. It turns out that both the ATTiny85 and the ATmega328 (Arduino) chips both contain an analogue comparator, hooked up in such a way that zero crossing counting can be done extremely efficiently. Continue reading "Instrument Tuner - Zero Crossing analysis"
Saturday, January 28. 2012
Instrument Tuner - Audio Input Stage Posted by Fanjita in Arduino at 00:36
I've been experimenting with creating some sort of instrument tuning helper device, as it seemed like a good mix of analog and digital, as well as a useful thing to have around the house after the arrival of a Ukulele shortly after Christmas.
More on the trials and tribulations at the code level later, but I thought I'd experiment with the Fritzing circuit design package as a means of recording my more complex circuits, starting with the AF input stage for the tuner. At first glance, Fritzing seems like everything I need:
Thursday, January 26. 2012
Servo toy Posted by Fanjita in Arduino at 22:36
Most recent first... Yesterday it occurred to me that I haven't ever played with servo motor control, despite having received one in my Sparkfun starter kit.
Since I'd just received a Wii Nunchuck breakout adapter from ThingM Labs, I figured I'd kill two birds with one stone and have a bash at controlling a servo with a nunchuck.
The circuit couldn't be much simpler, just connect the servo power to 0V, 5V and digital pin 9, and plug the breakout board (after soldering on a simple 4-pin header) into analogue pins A2-A5:
Continue reading "Servo toy"
Thursday, January 26. 2012
The silence is broken Posted by Fanjita in Arduino at 21:19
Defined tags for this entry: Arduino
Gosh. It seems like forever since I blogged here. And that's maybe because it is.
I've discovered a new playground recently with Arduino, and the world of physical computing, and so it seemed worthwhile to start recording some of my adventures.
Arduino is an incredibly easy way to prototype embedded computing hardware - sometimes known as physical computing, because it's all about the process of interfacing microcontrollers with the physical world. Once upon a time, prototyping such hardware required a lot of knowledge, equipment, money and effort - so although I was capable of doing it, I rarely bothered. But Arduino changes all that - making it trivial to run software within gadgets, and to develop intelligent hardware that can easily interface to a standard PC.
Arduino consists of an IDE, a standardised hardware platform, and a set of libraries, all of which are open source. If you've never tried it, then I urge you to give it a go - you can buy a starter kit that will give you weeks of fun, for less than £50, and it's a completely open-ended hobby.
Anyway, this section of the blog will be used to document some of my Arduino projects, and the lessons that I've learnt along the way. That's assuming that I can tear myself away from playing for long enough to type things up...!
Tuesday, October 28. 2008
Say no to Phorm! Posted by Fanjita in Blether at 01:02
If you live in the UK, you may be aware that some of the major ISPs (Virgin Media, BT) have been in discussions with an ex-spyware company (Phorm) to set up a system (WebWise) that will eavesdrop on all of your internet activity, so that it can send you adverts.
This is unacceptable - it contravenes several privacy and copyright laws, and although there are claims that it is 'completely safe', the companies involved have displayed a terrible record of deception and disrespect of people's rights. The authorities have so far refused to intervene, so it's up to the people to try to sort things out for themselves.
There are plenty of activist sites on the net to give you information on the issues involved (start at Bad Phorm), and I urge you to take a stand if you value your privacy. If you're with one of the affected ISPs (especially BT), then you really should be thinking about getting a new ISP, one that will not sell you down the river.I've done my bit by starting to pull together some easy-to-use tools for webmasters to control who gets to visit their site, and to automatically warn people who are subject to Phorm about the issues facing them. You can check it out here: Phorm Check Database .
Sunday, August 26. 2007
The Last Hurrah Posted by Fanjita in Blether at 23:25
It's with much regret that I have to announce that I'm going to retire from the sharp end of the PSP homebrew scene. The betrayal of trust that preceded the Pandora release was extremely hurtful, and has left me unable to fully trust the people I'd previously enjoyed working so hard with. And so, I have had to decide to stop working on projects that require that level of trust.
Besides that, life continues to be very busy in the run up to fatherhood, and there are various non-PSP projects that I'd like to play with. Not to mention the fact that I'm tired of the continual pressure and idiocy of the PSP scene - long gone are the fun days of pioneering amongst like minds, in a mutually supportive and gentlemanly environment.
The Pandora Battery therefore marks my last major PSP project. I expect that Team C+D and Noobz will continue to release stuff without me, and I still hope to finish up some of the non-exploit projects that I'd been working on (Installotron, piKey etc.).
It was a fun ride while it lasted.
Wednesday, July 18. 2007
Fringe Benefits Posted by Fanjita in Blether at 23:31
Defined tags for this entry: Blether
I mentioned a while back ("Busy Busy Busy") that I've been working on a non-PSP project recently.
Well, it's a website that has recently gone live, although there's lots of exciting content still in the pipeline for the next few weeks. The website is FringeGuru.com, and essentially it's a visitor's guide to the Edinburgh Festivals (including the famous Fringe) - not so much about what's on, but more how to make the most of it and to "do" the festivals most effectively.
I think it's going to be a great resource for the thousands of people who descend upon Edinburgh each year - if you're planning to come here this summer, then why not take a look?
Wednesday, July 11. 2007
The Roll of Dishonour Posted by Fanjita in Idiot's Corner at 21:04
Defined tags for this entry: idiot's corner
Aharrrr! Here be a list of scurrrvy dogs that be writing to me for blatant help with piracy.
Don't want to be on the list? Then don't send me stupid emails.Continue reading "The Roll of Dishonour"
Sunday, July 1. 2007
The morality of downgrading Posted by Fanjita in Blether at 17:28
So, we recently released the v3.50 PSP downgrader, and it was interesting to see how many people commented on forums etc, to the effect of "every time you release a downgrader, you're boosting piracy on the PSP". That got me thinking - is piracy my fault?
After a lot of soul searching, I'm satisfied that the answer is no. And here's why...Continue reading "The morality of downgrading"
Thursday, May 10. 2007
The Fanjita Monologues Posted by Fanjita in Blether at 21:48
Defined tags for this entry: Blether
I was interviewed recently for the gaming section of a local events and reviews magazine, "The Skinny".
Although a few of the details are slightly off the mark, the gist of it is on track and makes a decent read.
You can find the article here.
EDIT: Some people have asked, "Are you really writing your own firmware?". The answer is no - that comment was in the context of a discussion about custom firmwares, specifically OE, and how that was really the future of homebrew exploiting. I don't have a secret all-new firmware release hiding up my sleeve!
Sunday, May 6. 2007
Busy busy busy Posted by Fanjita in Blether at 17:24
It seems that various events in my life mean that I won't be able to spend as much time on PSP projects as I would like for the near future.
For one thing, my wife is expecting our first child (yay!), and there's a LOT of preparation to be done - not to mention more things that I need to help out with around the house.
And it's not just time, but money that's in short supply. Since PSP development doesn't pay any bills, I've been having to do some web development work.Continue reading "Busy busy busy"
If you have found my site or software useful, please consider donating a small amount of money using the button below.