Programming - Electronics Blog

Archive for the ‘Programming’ Category

ATtiny13 POV display: same hardware, different message


St. Patrick’s Day is coming up and I thought it’s already time to update the original Valentine’s Day POV display with a new message and make use of the second PCB I had done at BatchPCB. Also, fortunately, John “smeezekitty” (the author of the Attiny13 core used for programming it in Arduino IDE) stopped by my blog and pointed out to an issue with the original firmware, which prompted me to take another hard look at it and the result has been a saving of whopping 20 or so bytes – it was just enough to fit the word “BEER” which, as I mentioned in the original post, we did not have any space in flash left for. Well, now we do and below is the new software Read the rest of this entry »

ATtiny13 12-LED blinker with motion detection and scripted blinks



I can hear you screaming:”Not another LED blinker!” and yet here it is, packaged into yet another transparent Ferrero Rocher chocolate box, just like the first one. Why another ATtiny13 LED project? I needed to change the software to add a new feature and I had another box stashed away after Christmas – that alone should have been a reason enough :) Additionally, I have to admit right here that there will likely be one more post that includes an ATtiny13, LEDs and chocolates before I let it go (soon, I promise) and move onto more serious things, such as the DVD-CNC project that’s been languishing on and off my workbench for more than a year now.

That said, if you are still interested in programming ATtiny13 with the Arduino IDE to blink 12 Charlieplexed LEDs, respond to motion (shaking) and have the LED on/off sequence scripted in an orderly fashion rather than random or simply 1 through 12, then read on! Read the rest of this entry »

Free your Arduino code from the Arduino board

Atmel AVRISP mk II programmer is getting ready to burn some Arduino bootloader code

Atmel AVRISP mk II programmer is getting ready to burn some Arduino bootloader code

Arduino as a system is a great development tool that makes it incredibly easy for a beginner to start programming microcontrollers and for a seasoned programmer to whip up a quick code in a hurry or keep a large embedded project organised when needed. I think it is very valuable for a user-friendly development environment to have a familiar setting to work in: a familiar IDE, set of libraries and a well-known hardware configuration, all of which Arduino provides splendidly.

However, the hardware – the Arduino boards, all 150,000 variations of :) – may not necessarily work very well for every occasion. Depending on your application there may simply be no space for a 2″x2.5″ board. Additionally, there’s always the question of cost: an MCU chip and a couple of extra components that you actually need for the project may not always justify the cost of the whole Arduino board, voltage regulators, LEDs and all of the extra goodness it provides.

I set out to figure out what it’s going to take to create an MCU development environment in which the code could be developed using all the familiar Arduino tools and then transferred to a stand-alone Atmel MCU so the Arduino board could be reused for future projects, along with all the above mentioned savings. My item of particular interest was to make all this work in Ubuntu Linux – my OS of choice for the last 4 years.

The quest has been helped in no small part by Newark – an electronic components distributor – who has generously provided an Atmel AVRISP MKII programmer – an essential tool for moving the code to stand-alone MCU chips. They carry a whole line of MCU development tools for your MCU family of choice and the AVRISP is one of the most economic ways to get you started programming Atmel chips. Check them out! Read the rest of this entry »

Arduino Code Tidbits – #1 – Declaring an Array with Pin Values

Arduino Code - simple yet sometimes so challenging!

Arduino Code - simple yet sometimes so challenging!


Every once in a while you come to a point in writing a software program where you spend unexpectedly long time trying to write just one line of code correctly. Has it ever happened to you?

I had one of those forehead slapping moments a couple of days ago writing a program controlling a brushless DC motor. I’ll post the full program that came out later as a part of the description of an upcoming project. Just wanted to say that ironically, the Arduino code tidbit I want to describe here did not actually make it into the final version of the sketch! But I was surprised by having to spend so much time researching such a simple issue and finding it mentioned in neither official Arduino references nor elsewhere online.
Read the rest of this entry »

Arduino Code Syntax Highlighting Plugin for your WordPress Blog

Arduino Brush for SyntaxHighlighter Plugin - sample of output

Arduino Brush for SyntaxHighlighter Plugin - sample of output

Ever since I published the first lines of Arduino code on this site I was not satisfied with the way it looked. I’ve been using various IDEs (Integrated Development Environment) and advanced text editors for programming for a very long time and have gotten quite used to the software marking various important parts of my programs with different colors and bold fonts. Indeed, Arduino’s own IDE does exact same thing although I have to admit I would love to change the way it marks things a little bit, whenever I get time for it. Nevertheless, Arduino IDE’s color-marked up code is very useful and makes for an easier read, especially for someone not familiar with its specialized functions such as digitalWrite() and such.
It this kind of color markup that I wanted for the code posted on this site. Enter SyntaxHighlighter Evolved WordPress plugin
Read the rest of this entry »

Tools

Coming soon ...

Recent Comments
  • mirceboy: Hello, this is perfect and im new with arduino, can you please tell me if its possible to change the code...
  • admin: That sounds great! Sorry I did not have a chance to follow your previous comment. But in general terms this is...
  • Mark: Hi Sir. Just dropped by to report that I have made the unipolar stepper motor rotated clockwise and...
  • Mark: All right sir I got it. Like any other post in some websites, I have found out that pins 5&6 (which are...
  • admin: If we are talking about unipolar (not bipolar, as in the title of this post), then yes, you may have the 5-pin...
  • Mark: Hi Sir it’s me again Mark. Just wanted to ask another one thing sir. Just wanted to ask if there are such...
  • admin: Thanks for stopping by, Peter. Sure you can deploy the Syntax Highlighting javascript in a plain HTML file....
  • Peter Newman: I realise that this post is quite old now and may not be monitored but just in case: I am wondering if...
  • Milo: Thank you so much, it really helps. I found this: http://optics.ph.unimelb.edu.a u/atomopt/diode/gh0781ra2c....
  • admin: I would say the IR estimation is way off. I don’t actually know it but it looks like it’s below...
Meta