I game, I code, I break things
Technical, constructive, fun.
Menu

Arduino IDE on Windows with Minimus32 Profile June 5, 2013

Some time ago I typed up an explanation and presented a download of a compressed file for the Arduino IDE on Windows which included libraries for the Minimus32.

The zip file was/is unnecessarily bulky and has folders in places where they don’t need to be. So I decided to create a script.

The script downloads the Arduino IDE, of a version which you specify from the Arduino Website along with PBrook’s Minimus32 and OneWire components from his GitHub page and also the pre-compiled version 4.7.0 of AVR-GCC for windows (if you want a different version then feel free to update and compile from the source code yourself but for now it’s supplied by yours truly).

It then puts it all in a folder called ‘ide’ and it should copy/rename/move everything in its correct place within a sub-folder. The drivers still have to be manually installed.

There are some thoughts on what I’ve done:

1. Alter the script so that it scrapes the Arduino site for the latest stable revision number.
2. Have the drivers self-signed so that the don’t prompt with an error message. This can’t be done as self signing only works for the system it is signed upon.
3. Use a command line tool to inject the drivers into Windows / auto install them.
4. Perform error checking in the script. I have since done this to at least check that the files exist, but nothing more.

The over-all benefit of this, I feel, is that it’s not waiting for me to do a ‘snapshot’ and anyone can now check the latest version (if they modify the script a bit), type it into the script and when it’s finished downloading it should just work nicely without having to do anything (much) extra.

So once you’ve downloaded it. Extract it to wherever you have write access to, then just double-click or run install.cmd from a command prompt.

You shouldn’t need to, but run it as Administrator if you really get into trouble.

I mainly wrote this for myself, because I’m lazy. So if it does help anyone else, great. I am also aware it could be implemented a lot better, so go ahead.

Download: Arduino IDE Download Script for Windows with AVR-GCC 4.7.0 + Paul’s Minimus32 Profile & Internal PullUp OneWire Library (2.98mB)

Comments Off on Arduino IDE on Windows with Minimus32 Profile

Arduino IDE on Windows June 3, 2013

If I have learnt anything from software development over the years, it’s that programming on Windows is a mixed bag. Even more so when it comes to the development of hardware, as I have learnt more recently since joining the Leeds Hackspace.

The Arduino, a rather nice prototyping board, does have an Integrated Development Environment (IDE) for windows, but when you try to do that little bit more with it, such as code for an unorthodox piece of hardware it can get a bit trickier. Namely, when certain chips aren’t supported.

The Arduino IDE (AIDE) is actually a mixture of smaller components. A Java GUI, the AVR-GCC compiler, source code in C++ and profiles for the various Arduino hardware. A problem mainly arises when you want to use a new device, that is perhaps acting like an Arduino but is using a newer chip on the board than is supported by the archaic AVR-GCC compiler that is bundled with the AIDE.

I’ve been working on a script which pulls down the latest AIDE and incorporates support for, in particular, the minimus32 (using the ATMega32u) but it isn’t exactly user friendly (yet). Until that appears (though if you want to try it out, get in touch), I have happened across a rebuild of the Arduino IDE which is a bit nicer and, perhaps with suggestions for including decent updates such as a recompiled AVR-GCC, it could potentially be a better solution.

Comments Off on Arduino IDE on Windows

Self Calibrating Potentiometer December 31, 2012

Update: Code edited for clarity and make sure you read pbrook‘s comment

So I have a dial connected to an Arduino, a potentiometer (pot), it’s the typical item you might use for volume or brightness control, turning it all the way up to 11. Here’s the problem though, you’re reading in the analogue values of the potentiometer and you think it goes from 0 to 1023, possibly higher if it glitches a bit (though this isĀ dependentĀ on how it is handled in your code).

However, what you’re controlling, only goes from 0 to 10, maybe. What do you do?

Well one idea, is that you convert it to a percentage before making the comparison, I think this is effectively ‘normalising‘ the values – statistically speaking. This is really useful. So in this code I’m doing two things, one is that I am normalising the values but the other is that I am calibrating the values that I am reading.

Why should I be calibrating? Well, this code is then portable (the mathematics could apply to anything similar, as I see it), not only that but if the ‘pot’ needs replacing, then if it is placed in the ‘maximum’ value position for a while, then it’ll be accurate (well enough so).

#include "math.h"

int sensorPin = A0;
int maxVal = 0;
float sensorValue = 0.0f;
float percentile = 0.0f;
float temp = 0.0f;

void setup() {
 Serial.begin(9600);
}

void loop() {
 sensorValue = analogRead(sensorPin);
 percentile = (sensorValue / maxVal) * 100;
 temp = fmod(percentile,10.0);
 if (temp > 0.5)
 {
     percentile += 0.5;
 }
 if (percentile > 100.4)
 {
     maxVal++;
 }
 else
 {
     Serial.println((int)percentile);
 }
}

The code utilises the C++ Math library, and rounds the value from the pot up (I think, I should probably double check it) using the function ‘fmod‘. If the pot is set at the maximum it is capable of being at, it will increase the ‘maxVal’ variable to work out the correct 100% value to calculate with.

If anyone has feedback or corrections on this, please comment!

Comments Off on Self Calibrating Potentiometer
Categories: arduino code