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

OpenWRT on an MR3020 – ish January 25, 2013

I bought a portable 9000mAh battery pack – which gives out 5 to 5.5v at 2200 mA. Why? Well the intention here is to power something which doesn’t take much, well, to power, for a very long time. This is where the MR3020 steps in.

By default its intention as a device is to share, over 2.4Ghz WiFi (I think, I’m not sure if it does 5Ghz, I haven’t checked, but it does do 802.11bgn) a 3g or 3.5g mobile connection (from USB). It can also share this over your standard LAN Ethernet, or it can share the Ethernet over the WiFi.. I think you get the idea?

Well there’s this firmware called OpenWRT which lets me do what I want with it, effectively turning it into a small, linux-esque computer with its Atheros processor at the core.

So my intention is to plug in a GPS adapter, USB storage pen-drive, configure the device over Ethernet and use that 9000mAh battery pack to power it. I didn’t mention? The MR3020 is powered by a mini-usb port. Wonderful.

However, this project hasn’t been without, shall we say, trouble. You see, when you flash a firmware (its Operating System, like Windows or Linux) to the device it is then restricted to those files and programs in that firmware (short of some configuration files) and to expand upon it further you need to to install them. This can be done through ‘opkg’ which is OpenWRT’s package manager.

Unfortunately you’ve just used up the majority of the space on the device flashing the firmware, so if you’re fortunate you can add the packages to allow you to use a USB storage pendrive. If not, it’s time to make your own tasty good make feel nice firmware.

Which is what I tried to do. This did not go well. This is because the core of the firmware, at the base of it all is the kernel which interfaces between the software and the hardware. I had foolishly filled it with too much and it couldn’t load it. I had effectively ‘bricked‘ my mini router. That is to say, it no longer functioned as it should and it was stuck in a loop, rebooting.

A bit of soldering, the assistance of Nav from the Leeds Hackspace lending me a serial cable later, I was back on track with a working device. What I had to do, was transfer a new firmware to the device, using only the bootloader and TFTP (over Ethernet). This worked, to a point that I could now get into the failsafe mode of OpenWRT rather than just the bootloader. Where I then, more easily, transferred a better, larger, firmware to it and ensured that the configurations were reset to default.

Now I’m going to try building a firmware again, or maybe I’ll find one suitable and upgrade it. I had looked at PirateBox but that was mainly for sharing files, and MiniPwner – but the problems encountered with that (MiniPwner) are (by default) its kernel is out of date for the latest packages (easily fixed, I found, by using an upgrade firmware from OpenWRT) and a bit more tinkering to get it just right.

So back to trying to get the USB pen-drive and GPS to work at the same time (hacking in a USB hub) along with relocating the packages to the USB pen-drive.

Then, hopefully, I can do what I planned to. Triangulate and map WiFi access points on a Google Maps style layout referenced to GPS layout. Or something similar, maybe I’ll introduce BlueTooth or anything else I can pick up with a sensor. Yes, I might just be able to attach in a Minimus32.

Comments Off on OpenWRT on an MR3020 – ish

SD Card Writing with the Minimus32 November 20, 2012

Part of a project that I am working on to measure the temperature and log it, involves writing to an SD Card (reading from it is not so important). So as part of this I purchased some items from the Proto-Pic website, one of which was an SD Card breakout board which came with, as a new person to this, I felt, next to no direct guidelines or instructions on how to wire it up. Sure, there’s schematics and the SanDisk pin-outs. However, nothing particularly clear as to what, connects, to what.

Paul Brook has on his wiki, the pin-outs for the Minimus32 which clearly shows the SPI (that’s effectively how to communicate over serial) but translating this to the break-out board was troublesome. However, after trial and error and running out of memory, I discovered the following works:

SCK /10 -> CLK

SS  /9  -> D3

MOSI/12 -> CMD

MISO/13 -> D0

The first problem I had to overcome was the fact that the Minimus32 has 1k of RAM to work with, some of which is used up by variables, ,code running, etc. This was exasperated by the fact that the library I was using to talk to the SD Card, attempting to use FAT32, was quite bulky.

Thankfully, there is an alternative, FAT16 based library that claims to take up much less memory. The difference? This means that really, I can’t write gigabytes of data to an SD Card. When all I’m doing is logging temperatures, I don’t need that much data.

This FAT16 library requires a bit of hacking to get to work with the Minimus32, it requires a profile for the AVR_AtMega32u2 else it cannot identify the chipset, this is so that it can set the aforementioned PINs properly (I think it’s in SDCard.h in the library, which you put in the sketchbook/libraries/Fat16 folder) and be able to communicate with the SD Card.

In fact, it was this library, which because it was smaller and wrote out to the Serial (monitor-able using the Arduino IDE or HyperTerm or equivalent) gave me an error code which let me work out which cable I had connected incorrectly. (I had the CMD and CD connections crossed on the break-out board).

Damn I was joyous.

Comments Off on SD Card Writing with the Minimus32

Electronics at Leeds Hackspace with Arduino and Minimus32 November 16, 2012

Update: While this version of the Arduino IDE will work, I have attempted a way of getting the latest version.

Within the past few months I picked up a new hobby, my friend Kai mentioned this place to me once before and I’ve always had an interest in electronics so off I went to the Leeds Hackspace.

To prototype electrical, let’s say, gadgets there is a device called the Arduino which with a little bit of C++ programming, some wires, LEDs, buzzers, chips, etc. You can get up and running into a large or small system to do almost whatever you want.

Typical applications involve constructing an autonomous robot to controlling laser cutters. Lasers are fun.

So along came this device, called the Minimus32 which, I’m told, was originally intended for circumventing the copy protection on the Sony Playstation 3. Turns out, however, that this little device uses the same chipset as an Arduino and can run the same code and behave in the same way, especially when it has been flashed with a new DFU Bootloader. The best part about this, is that the Minimus32 is typically about a fifth the price of the equivalent Arduino (possibly Leonardo model).

To get this to work under Linux is quite straight forward (at least within Debian and Ubuntu). You use the Arduino IDE 1.0.1 and you grab the profile information for the board from Paul Brook‘s github repositories which allow you to upload the code and monitor the serial port. It also interprets some of the default pin-outs and Paul also has a slightly re-worked OneWire library to use the internal pull-up resistor on the board.

When it comes to Windows, however, it gets a little bit tricky.

As it turns out, the latest Integrated Development Environment (IDE) for Arduino comes with an ‘avr-gcc’ compiler, which handles the compilation of the C++ code. However, in the windows bundle from the Arduino site this is grossly out of date. When this is combined with Paul’s hardware profile for the Minimus32 and a flashed Minimus, the compiler doesn’t know what to do with it.

Fortunately, I have scoured about, packaged together the IDE, a ‘sketchbook’ folder (where the hardware profiles/libraries are stored), an updated WinAVR compiler along with a recently compiled avr-gcc compiler (c/o Andy Brown). If you do not change your Arduino IDE preferences to use this sketchbook folder, you will not be able to select the minimus32 as your board (which is required).

I’m happy to say, that using the drivers supplied with the latest Arduino IDE for windows (1.0.2) along with the updated compiler and Paul’s hardware profile I’m quite happily compiling and working with the Minimus32 on windows (version 7, 64bit). Oh, and Paul’s hardware profile also include the DFU Bootloader to turn the Minimus32 into an Arduino.

Download: Arduino IDE 1.0.2 for Windows with Compiler + Paul’s Profile / Library (98mb)

Comments Off on Electronics at Leeds Hackspace with Arduino and Minimus32