Hacking, Modding, Programming……

I’ve been doing things a little out of the norm lately. Specifically, as the title suggests, hacking, modding, and programming. Not the physical hacking and modding that most of you are used to seeing on this blog, but code-only modding with the popular Java game Minecraft. I wanted a way to learn Java coding, but most outlets for coding in Java involved assuming that you already knew some of the basics of coding in Java, which I hadn’t. That is, until I found out about Minecraft modding. It had hundreds of tutorials out there for people that didn’t have any experience at all coding, and it was quite easy to pick up. I had downloaded eclipse so I thought I would give it a shot, and I made a few mods. The first one was a waste of time, getting about 350 downloads (more than I could dream of getting on Propeller code, but a low count for a Minecraft mod) however I gained a valuable experience in what to do and what not to do when modding. The second one had some time put into it, and it became mildly successful, getting over 3,500 downloads in a month and still counting. I won’t post the details of the mod here, as I know most of my followers are technical readers who couldn’t care less, but if you want to know about it you can see the link in the Minecraft forum here: http://www.minecraftforum.net/topic/1095388-125ssp-mo-splosions-v12-the-ultimate-explosives-mod/

(keep in mind, I only linked to the good one) :)

Though electronics is my preferred outlet of interest, it has one caveat: Expense. Programming does away with this, which is why I have been working with it for the time being. I will post with some more electronics-fun soon, and finally get that stingray update working properly. :)

Thanks for reading!

 

Posted in General | Leave a comment

ALICE Artificial Intelligence on the Propeller! (AIML Interpreter)

NOTE: THIS PROJECT IS STILL IN PROGRESS. CHECK BACK FOR UPDATES.

UPDATED TO VERSION 0.7 ON 1/20/12

My project over winter break has been to successfully port the ALICE AI onto the Propeller chip. After 1.5 weeks, I’ve finally finished what I set out to create, a working ALICE interpreter for the Parallax Propeller. I’m releasing it now even though it is not entirely done, for 2 reasons. (1. Classes start back on Monday, and I want to get this out before I have other things to worry about. (2. The sooner I get this out, the quicker I’ll be able to get support and help with it.
This interpreter has a lot of data to chew through, and for added speed it is really deserving of a multipropeller system, but I have designed it for use with a single Propeller so that anyone can download a try it. The download link is at the bottom of this article

Here are the pros and cons of the current system (v.1.7)

PROS:
- You can carry on a simple conversation with it without too much error.
- It is very versatile code and can be easily adapted to many projects.
- You can easily add your own data due to the easy editing of AIML.
- It’s AI!!

CONS:
- EXCRUCIATINGLY slow!! Sometimes you’ll get an answer in a few seconds, other times several minutes. It’s like talking over email or text. This is why it needs a multipropeller system!
UPDATED: Now only certain questions are slow! Anything NOT starting with WH, IS, DO, I, AR, YO, or CA are answered in a couple of seconds! Optimization for these starting letters is in the works for version 0.8
- Still displays some of the lesser used tags like HTML tags, ul, random, set, bot, and think.
- Takes up over half of the memory. This can be adjusted though.
- Does not capture the text AFTER a wildcard (“*”). This will sometimes give you interesting responses, especially if you type “what is a [blank]“. I’m working on this and should fix it soon.
- Does not filter out punctuation and white space.

If you want, you can download and try this out now!
You will need:
- Demoboard or similar configuration
- SD card and holder/breakout board
- VGA monitor
- Keyboard
- The source code! Download it here!
- The ALICE brain file. This goes on the SD card. Download it here!

Directions:
On a demoboard, connect the SD card to pins 0 through 3 in the standard configuration. Connect the card to a computer and unzip the BRAIN.zip file to the card. Program the EEPROM on the Propeller with the linked ALICE file. Plug in a VGA monitor and a keyboard. That’s it!
Make sure you DON’T use ANY punctuation when you type, as it doesn’t filter this out yet.

Thanks! I’ll post with updates soon! If you want to ask a question, contact me at info@microcontrolled.com

Posted in General | Leave a comment

Stingray Robot – Update 2

Picture of the new Stingray remote
Ever since winning my Stingray, it has been the one “ongoing project” that is continually being updated in little ways. The pictures I have for this second update don’t even have some of the most recent upgrades, as they were taken about a month ago. Speaking of which, you may have wondered why have haven’t posted in so long! Let’s just say I’ve had a large (paid!) job that has consumed much of my free time over the past few months, and that’s all I’ll say on the matter. Now! No time to waste, here’s the list of most recent updates, along with some pictures!

I have COMPLETELY rebuilt the remote, so that is mostly what the updates are for.

New Stingray improvements:
- Now armed with a Nerf gun
- Features a backlit LCD for readout of data like speed control
- Plugs directly into the wall for charging
- Has a frontal collision plate to avoid gearbox damage
- Features a full speaker system and is capable of playing WAV files read from the external SD card.

New remote improvements (that’s what has changed the most, after all):
- More simple, clean, and accessible
- More accurate control with a triple axis hall effect joystick
- Easy speed readout
- 2 steering options: Preset and Scaled. Preset is the simple Up, down, left, right control whereas scaled takes advantage of the accurate joystick and uses a software algorithm to control the robot based on the joystick location.
- Easy speed select with the third axis on the joystick, so speed can be adjusted while the robot is moving
- Dart launch button (Duh!) with indicator light
- Wav file playing/stopping button.
- NEW Speed lock switch – this switch lets you lock the speed controls so that you don’t accidentally change it while navigating the robot

And of course, it is much nicer and more practical than the previous remote. The only disadvantage to this one over the previous model is the lack of a touchscreen. The touchscreen on the other model was simple impractical – it was only used for 3 functions, ones that simple buttons could replace. Personally, I am a fan of analog interfaces.

However, if you still want to see the old one, you can see it in an old forum thread here: http://forums.parallax.com/showthread.php?130414-The-Coolest-Stingray-Robot-Remote….-EVER!!&highlight=Coolest+stingray+remote

I’ve been told that the mass amount of images on my blog slows down the connection in other countries, so I will be posting links rather than having them inline. Also, the setup is so large that it didn’t fit on the nice white background that I usually use. Here’s the links:
Picture 1
Picture 2
Picture 3
Picture 4
Picture 5
Picture 6

Thanks for reading, I hope to post new updates soon!

Posted in Ongoing Projects, Propeller, Updates | Leave a comment

Learning iPhone programming – Update 1

Where have I been? What have I been doing? iPhone programming! My previous update on Android programming, from which I only toyed around with, is a lot different than this. Rather than just evaluate the software and programming experience, I have taken the full plunge into iPhone programming. I got a shiny new 21.5″ iMac, a book on Objective-C, and (of course) Xcode! The iMac isn’t just for me, nor was it bought primarily for iPhone programming. It is the new family computer, and I just had some persuasion on getting an iMac instead of a Windows machine. You will notice that this is “Update 1″, assuming that there is going to be more. This is because I plan to post more updates once I subscribe to the Apple developer program, and when I release some apps. Considering that the Apple developer fees ($100 a year!!) are coming out of my personal budget, I want to actually get an app made before I go and buy into the program. Until then, I can’t put apps on my device or submit them to the app store.

I wanted to do a review on the iMac, but I’ll save that for another post as it’s a little off topic now. This review is about Xcode and Objective-C. Lets get into it now! Objective-C is one of the strangest languages I’ve ever programmed in. Aside from objects, it uses a total of 4 programs, 2 of which have to be manually edited every time you add a user interface. It has a Delegate header file, a Delegate implementation file, a Controller header file, and a Controller implementation file. The Controller implementation file is the one where most of the main code takes place, as it provides access to methods that are related to the user interface. However, you have to take care of the UI also in the Controller header file, by declaring and setting the variables as properties that are passed on from the Interface Builder. Lost me? The Interface Builder is a completely separate program that edits the .xml file that the user interacts with. It’s the most user-friendly part of the whole setup, but is still complicated in contrast with the interface builder in Visual Basic 2010. After placing your buttons, labels, or anything else you want to interact with in some way, you have to connect it to the main file by holding “Control” and dragging a line from the item to the File Builder logo in one of the 4 windows the program uses. You then select a variable to connect to, and presto! You have a linked UI! At first I found this exceptionally complicated, but after a week of working with it (for that is how long I have had the computer to this date) I have grown to appreciate it.

To give you an accurate example of iPhone programming (of what I’ve learned so far, anyway) here is a little walkthrough of how to make a program that let’s you push a button to make it tell you “Hello”.

Open a new project in Xcode, select “View-Based Template” and give it a name.

First, update the Controller header file (.h) with the following code in the implementation loop:
IBOutlet UILabel *outputLabel;
Then this outside of the loop before the “@end” statement.

@property (retain, nonatomic) UILabel *outputLabel;

-(IBAction)activateHello:(id)sender;

Now, save your files and open up Interface Builder by double clicking the “ Interface.xml” file and add a new button and Label. Link them to the “outputLabel” and “activateHello” controllers (a.k.a variables) that we defined earlier by Control-dragging lines from the File Owners icon to the item. Select the appropriate controller when prompted, then save and close interface builder. Go back to Xcode, edit the Controller Implementation file with the following code under the header-code right before the first comment:

@synthesize outputLabel;

-(IBAction)activateHello:(id)sender {
NSString *helloString;

helloString = [[NSString alloc] initWithString:
@"Hello there"];
[outputLabel.text = helloString.text];
}

That’s it.
————————————
There you go, a quick little runthrough on iPhone programming. The text beneath the little dashed line was written 31 days after the original article. Why? Upon visiting my site I realized I had forgotten to push the “Publish” button so this draft had been sitting in my browser the whole time. Nice.
Well at least you will get another article soon.

Hope you enjoyed it!

Posted in Experiments, Observations, Updates, Works in Progress | Leave a comment

Writing a Nuts and Volts article


To all you who have been wondering why I haven’t been posting new articles on my blog: I have been working on writing an article for a magazine. As some of you may have known, I have written for the electronics magazine Nuts and Volts in the past. Writing for them is both a challenge and a great experience, and I have been waiting some time before I had an opportunity to do it again. In order to write an article for Nuts and Volts, you have to have the perfect project to fit the role. It has to be unique, fun, and altogether interesting; even if it isn’t economical. The last project I did was a box that would only unlock if you waved an RFID card over it (the cover for the issue I was published in is the header image) , this time I’m entering the FlipClock.

I have spent the last several weeks writing the article, assembling the BOM and getting the pictures ready. The article has not yet been accepted by Nuts and Volts, which means that I can post it here free for your viewing until it gets accepted, in which it would then be the property of Nuts and Volts. You can download the viewer-friendly article including photos, BOM, and a full How-To guide from the link below. Keep in mind, this is a rough draft only.

Click here to download the PDF version of the Article

UPDATE: My article was dejected because the project was “too complicated”. Sigh. I’ll try again soon.

Posted in General | 3 Comments

The FlipClock – An accelerometer controlled Digital Clock

One of those things you dread about morning is waking up to a blaring alarm, and fumbling sleepily around for the off switch. Don’t you wish your clock would get the hint when you’re knocking it on the floor trying to press that blasted button? Well, no more of that! This clock doesn’t have an off button at all! In fact, it doesn’t have any buttons! The only thing you need to do to turn it off is knock it over!
Introducing the FlipClock!!




The FlipClock is controlled by a Propeller Chip and uses a GPS module for timekeeping and a 3AD module by Rayslogic.com as the accelerometer. When building this project, the biggest concern was the power and sound, which should have been the least of my worries. I ended up using a power source ripped off of a Propeller protoboard, however, I originally used a PowerTwig. The problem with the PowerTwig was the low current handling, which although good for the Propeller setup, couldn’t drive the speaker circuit without resetting the Propeller Chip. I experimented with different setups, including attaching a heatsink, using an external 5V regulator, and using a potentiometer to lower the speaker input current. The external regulator was temporarily successful, but when I added the accelerometer it stopped working correctly and the Propeller started resetting again. Eventually I ended up replacing the PowerTwig with the salvaged power source. The speaker is the only disappointing part of this system, as it is as audible as a watch alarm, which is OK, unless you are trying to wake someone up, which is the whole purpose of an alarm! Lucky for me I’m a light sleeper and it does work.

Operation is very simple. To disable the alarm, simply flip the clock over. The digits automatically invert and the indicator light shows the status of the alarm. As previously stated, to turn off the alarm when it is going off, just knock it over. This clock is so simple to use I don’t really need to explain how to operate it. The time is taken from the GPS so it never needs set, and the alarm is at an unchangeable time (still working on this, but I promise I won’t add any buttons to set the alarm, I’ll just have to think of something creative).

And now for the most important part: Even upon close inspection, this looks like something you would buy! I’ve learned that a project that looks good is usually more accepted by those who are not into electronics, even if it is not as functional as others that look like a mess of wires [this is]. Another very important feature: This project is salvage-proof! I know that in a few months I’ll be wanting that GPS module back for another project, so I’ve built in a DS1302 RTC (Real Time Clock) that will take over as soon as the GPS module is removed. I guess the thing this project needed protected most from was myself.

Click here to download the Propeller Source Code

Thanks for reading! Please subscribe to my RSS and my YouTube channel, and don’t forget to like this article on Facebook!

Posted in Completed Projects, Propeller | 2 Comments

Propeller Clock: With a Propeller Chip! – “Digital” style POV clock

Everyone loves Propeller clocks! Now there is one powered by a Propeller Chip! If you don’t know what a “Propeller Clock” or a “POV clock” is, look at the images below. Also, FYI, POV stands for “Persistence of Vision”.

This is the Propeller Clock (or POV clock as it will now be referred to) in action.

This is a side view of the POV clock setup, complete with motor.

This is the POV clock from center view, as it looks like when you are looking at the time.

The POV clock is mounted on a CD, as shown here.

Here is the motor that spins the clock. It is powered by a separate power source and the motor has been taken out of a CD player, so it even has the attachment for spinning the CD on it, which is ideal for this setup.

As you can see in the pictures above, the hardware consists of a Propstick USB (the smallest Propeller module I had on hand), 2 AA batteries, and a row of SMD LEDs soldered on a piece of protoboard. I used wires out of an old 25-pin parallel port cable to lead to the LEDs, as it was very thin and did the job right. I didn’t bother soldering the 40 pin header the Propstick is plugged into on a Protoboard, and I just used wire wrap to get all 20 wires hooked up. The only other components I used was a 100 ohm resistor leading to the anode of all the LEDs, and a terminal block to connect to the power. The whole setup was mounted on an old CD, so that it could be used with a CD motor and could be taken off easily for modification.
In a project like this you would think the biggest electronic concern would be programming, but actually the hardest thing to get working was the power. Considering how weight plays a big part in how fast it will move and therefore how convincing the effect is, it is, you would want a smaller battery. So you may be wondering why I went with the heavy AA cells? Well, any other batteries couldn’t supply enough current and the Propeller would reset. I originally used a small 12V battery that weighed only a few grams, but the Propeller was resetting once every second. I then added the 100 ohm resistor so that the LEDs wouldn’t draw as much current, but it still reset once every 6 seconds. I eventually found that the only power source that would NOT reset the Propeller chip was 2 AA cells, which is what I ended up using. Of course, now I have the weight problem. Fortunately I found that it can handle the imbalance if I mounted the motor in a stable plywood casing, as seen in the picture above.

From a programming standpoint it is really quite simple. It has numbers and a colon (“:”) stored as longs in the data block, and they are directly accessed by the pins. There is no RTC on this clock, which means it has to be set in program and never turned off, but it keeps accurate time. When I get my RTC from Jameco I will use it instead, as it retains the time and is much more accurate. In the meantime, though, this is a good “proof of concept project”. I’ll post the modified code when I get it. Anyway, back to the program. It basically starts the timekeeping cog, then enters a repeat loop where it pulses out the numbers, then waits until it has made a full revolution, and repeats. It is really that simple. Designing the numbers in binary and tweaking the “pulse” and “wait” values was the hardest part of programming this project.

I have uploaded a video here
, but due to the low framerate of my camera, it didn’t turn out so well. Skip ahead to where it isn’t blurry.

Click here to download the source code

Thanks for reading! Please comment and subscribe to my RSS!

Posted in Completed Projects, Propeller | 12 Comments

Playing around with Android Programming


If you are wondering where I’ve been for the last few weeks, in addition to numerous other things, I have been studying the Android OS and native programming language for the sole purpose of one day creating and Android app that works, even though I have no Android to run it on. You may be wondering if programming an Android is anything like programming a microcontroller. IT’S NOT. Even if you are a great microcontroller programmer, which I am not, you will still have trouble switching to the totally different environment of the Android. I set my goals for the Android low, the first app I’m aiming to make only involves counters, buttons, and text boxes. I still don’t have a working version, though.
But that aside, let me give a quick review of Android programming.

PROS:
(1: GUI interface for designing the user interface on the Android device.
(2: Very nice IDE with good error checking
(3: Writes in Java, which once you know the language that knowledge can be applied to also make Blackberry apps
(4: Includes a simulator, so even if you don’t own an Android, you can test it with a virtual one on your PC
(5: Uses Eclipse, which can also be used to program the Blackberry

CONS:
(1: Java is a very hard language to get used to if you have only written in SPIN, Python, and similar languages. It should be an easy transition from C or C++.
(2: You have to import EVERYTHING YOU USE in the main Java file, instead of it doing it automatically when you add the feature in the GUI editor.
(3: The GUI editor doesn’t allow you to have more than 1 feature in line unless you change the layout. This can be annoying if you want a button next to a textbox, or something similar.
(4: The Emulator takes a long time to load, about 5 minutes per debugging, which gets tedious to test minor updates
(5: Starting a new project is a long process and is easy to screw up if you enter, say, the wrong Android version and “Mini SDK number”.
(6: Eclipse is fully featured and therefore has a heavy processor draw on your computer, especially slower ones, and takes a few minutes to start up after you click the icon
(7: Installing all the software to program the Android is a PAIN and is a process also easy to screw up.

Here is what I use for reference.
The Android Developers Site
The Hackaday Android tutorial

I’ll update if I make any more progress with the Android, (other than making a list of pros and cons!!) but for now, I’ve started working on another project with good ol’ microcontrollers. If it works, I’ll post a writeup about it. If it doesn’t, well, I’ll still post something about it.

Anyway, thanks for reading! Subscribe to my RSS!

Posted in Experiments, Ongoing Projects | 3 Comments

Digital Measuring Tape – AKA poor man’s mini-rangefinder

This is one of those small-but-valuable projects. Simple, but useful. The guts of it is basically a Propeller module cut out of the middle of a Protoboard, (I’ve used this before, Jeff Ledger has an article on it on warrentyvoid.com) a PING ultrasonic sensor, a 3 digit 7 segment LED display, and a PowerTwig from WBA consulting. The whole thing is powered by a 9 volt battery.


Sorry for the fuzzy picture

The program is straightforward, it reads the data from the PING with the default PING object, than converts the value to decimal and displays it (using multiplexing) to the 3 digit 7 segment LED display. The code does have limitations, though, that should be overcome with some experimenting. For starters, it only reads up to 125 inches, when the PING could probably read up to 25 feet. This [I believe] is due to a code size limitation; the amount of microseconds 1 long of data can hold. I’ll be working on it, setting up a terminal to log the amount of ticks from the PING and measuring (in feet) the distance to make sure the data is consistent.
If I modify the hardware it would be to, oh, ADD AN OFF SWITCH! Currently you have to pull the battery to cut the power because I didn’t have any small switches on hand to use for this project. I may also add a pushbutton and an accelerometer, then it would allow you to turn it to “level mode” for the full carpenter’s tool!
If you want to build one in a similar case, be sure to note that to fit the powertwig in, you kind of have to bend it around the curve of the plastic. Also be careful with the Dremel when you make your cut for the display so that you don’t have to cover up your “slip marks” with a nicely placed label and logo like I did!

I call this the “Poor mans mini-rangefinder” because it only costs about $50 to prototype: $30 for the PING, $10 for the Propeller setup (free if you use a scraped board like I did) , and $10 for the Powertwig. Of course this is assuming you already have a case and display, but even these don’t amount to much.

If you want the extremely versatile code for this project, you can download it here or on the Downloads page:

Digital Measuring Tape Source Code (.spin)

Thanks for reading! If you enjoyed it, please subscribe to my RSS!

Posted in Completed Projects, Ongoing Projects, Propeller | 2 Comments

RFID Employee Time Clock – Version 3

Yes, count them, 3. Over the past year this project has had 3 hardware reversions and 6 software reversions before it finally works the way it is supposed to. It also looks pretty nice, too.

I specified this as an “Employee” time clock so as to not be confused with an alarm-clock setup.

The RFID Employee Time Clock is designed for small businesses to log what time their employees enter and leave, add up the total working time, and print it out at the end of each week. Doesn’t sound hard, does it? Think again. First of all you’re are designing for a person that has minimal knowledge about computers, and doesn’t want to wait to get what he is after.
Last year when I created Version 1 of this device, I used a monochrome LCD for display (an obsolete part, not so great for mass production. :-) ), an RFID scanner for data entry (this remains), and 2 LEDs for displaying the current state of the card. The object used a Propeller chip and 7 out of 8 cogs. The data was stored on the 64k boot EEPROM and the program was riddled with EEPROM address errors. The data was read to the computer via a ratty Visual Basic program which also had consistent errors. In November of last year I just ditched the old one and created a new one with the Propeller Schmartboard that had a keypad for code entry in place of the RFID reader. This device even went so far as to place second in the Schmartboard MCU challenge Parallax Propeller Segment. However, I still didn’t like the way it worked, and I really like the RFID idea. So again I ditched it and recreated the original board without the obsolete LCD, and with an SD card in place of the EEPROM and VB program. Now it is working nicely in fully reproducible state. It keeps time with a DS1302 RTC.

When the SD card is inserted into the device and the device is plugged in, it copies an autorun file and a batch file to the SD card which will clear out the expendable directories and launch the HTML table having the time on it into the preferred web browser. The time is arranged into a table and stored to the SD card as a .htm file that can be opened and printed in the default web browser. All you have to do is pop in the SD card and run the batch file, it even handles the cleanup for you and deletes the timekeeping files so that it will be reset to zero when you put it back in.
I’d go into detail about what the code does, but since source code is worth 10,000 words (who needs pictures?), you can download the source code here.

RFID Time Clock Source Code (.spin)

I am planning on making this into an actual marketable product if I ever get the chance. I just need to clear up one small bug before the source code is perfect. Any comments or questions are appreciated.

Thanks to all my readers!

Posted in Completed Projects, Propeller | 7 Comments