aChaos – Update

No Comments »

I have updated aChaos to version 0.9.2.  The latest version has fixed some image viewing problems in Windows.

aChaos – new Journal software

No Comments »

I have made a beta of aChaos, a new journal software, available here.  I started writing aChaos in December 2011 after trying a few different journal apps for a while.  They didn’t quite do everything that I wanted so I was compelled to create my own.

aChaos is a journal that stores data locally with drag and drop features for images and files.  There are some other journal apps that store data on a cloud and work with tablets.  If you are looking for that, then you can ignore aChaos.

I wanted a rich text editor that makes it easy to add/embed images and files.  Also, I wanted a journal that can store lots of projects, together, but can still extract certain entries.  aChaos accomplishes that by dividing a journal entry into sections that can be tagged.  This allows a user to combine lots of projects into a journal and still be able to view one project at a time.  I have a lot more features planned, but wanted to release the state so far.

aChaos is written in Python and PyQt with a SQLite database storing the journal and json files for the lists.  I wanted to make the data easy to parse with other tools so that the ambitious user can extract their journal data however they want.

Screenshots

New Site Design

No Comments »

Welcome to the new design of Convoluted Logic.  To improve the ease of adding information to this site, I have converted this to a WordPress site.

Beer Case

No Comments »

After helping my dad brew beer and transport bottles in 6 pack cardboard beer cases up and down stairs many times, I came up with a great gift idea for him. Wooden beer cases. The design is based off of a German case I found instructions for online. I couldn’t find the link again, otherwise I would post it here. I shrunk the design to fit 12 oz bottles. There are other great designs online. Here are the features of this design.

  • Holds 15 12oz bottles
  • Heavy Duty
  • Stackable
  • Easy to carry
  • Made with only saw, drill, and screwdriver
  • One case is light enough for most to carry, and the more ambitious can carry two or more stacked.
  • 4 cases provides storage for a batch (~53 bottles) of beer

Materials

Part Board Size (in) Length (in) Qty
Short Side (Upper) 1×2 12.75 2
Short Side (Lower) 1×4 12.75 2
Long Side 1×2 16.75 4
Vertical 1×2 10 4
Bottom (sides) 1×2 18.25 2
Bottom (Middle) 1×4 18.25 1
Long Slats 1 x 3/4 18.25 2
Short Slats 1 x 3/4 11.25 4
Screws Lots

I created a top view 2D CAD drawing to assist with the measurements.

Instructions

Here is the best method I came up with after creating 4 of these. There are probably better methods.

  1. Set up the lower section of the case upside down. (not the bottom pieces though) No screws are used yet!
    • Lay the slats upside-down on top of each other (long slats on the bottom, short slats on top).
    • Place the short sides on the ends of the long slats (upside down)
    • Place the long sides on the short slats (upside down)
    • The lower section should now be upside down in the correct layout.
  2. Screw the short sides (lower) to the long sides.
    • Use a vertical piece to appropriately line up the long side to the short side.
  3. Measure the locations for the short slats and screw the short slats to the long sides.
    • Use the CAD file for measurements.
    • I predrilled the holes to avoid cracking the slats.
  4. Measure the locations for the long slats and screw the long slats to the short sides (lower).
    • Use the CAD file for measurements.
    • I predrilled the holes to avoid cracking the slats.
  5. Screw the long slats to the bottom slats in the middle.
    • This might not be necessary, but again I was going for heavy duty.
  6. Screw the vertical pieces to the short sides (lower).
  7. Screw the short sides (upper) to the vertical sides to create the handles.
  8. Screw the bottom pieces on.
    • Placement isn’t super critical, just make sure that the board runs underneath where the beer will sit.

Byte-size Cookbook Available

No Comments »

I created a new program called The Byte-size Cookbook and it is now available for download. Click here for more information.

Wiimote IR Sensor Position

No Comments »

The Wiimote also has an infrared (IR) camera and the Wii sensor bar is actually just 2 infrared LEDs. Using the Python Cwiid library, you can get the IR (infrared sensor) data from the sensor bar or another IR device (like a IR LED). This provides a better measurement of position. The Wiimote provides position and intensity values for up to 4 IR sources and the Cwiid Python module can provide this data for us also.

For this experiment I did not actually have a Wii Sensorbar, so I just used a IR LED that I purchased at RadioShack. It is a high intensity IR LED with a forward current of 100 mA and a forward voltage of 1.2V. Hooking it up to a 5 volt source, I used a 47 ohm resistor in series.

Velocity is calculated using numerical differentiation:

    • yi+1 – yi

      ———————

      ti+1 – ti

Acceleration is calculated as the second derivative of position with numerical methods:

    • yi+2 – 2yi+1 + yi

      —————————–

      (ti+2 – ti+1)(ti+1 – ti)

The following plot shows the raw output of the y position of the IR LED and also the calculated velocity and acceleration using differentiation.

Python Code

wiimote_record_ir_pos_and_accel.py – a program that grabs the y position of a IR LED, calculates velocity and acceleration, and plots the results.

Recording Acceleration with a Wiimote

No Comments »

Introduction

The Wiimote (Wii remote) has become a very popular toy without even using it with the Wii. There are much better hacks of the Wiimote out there like a virtual white board by Johnny Lee.  My project is just a simple program that uses Python to connect to the Wiimote and record acceleration data.  This program also has the following features:

  • Calibration – gets an initial reading when starting theWiimote to zero the data.
  • Data smoothing – averaging every 3 points
  • Records and plots acceleration, velocity (integrated fromacceleration), and position (integrated from velocity) vs. time
    • In order to get better results for velocity and position,a tolerance on acceleration is used.  So if accelerationchanges below a specified threshhold, velocity is kept constant.This provides better results, but the error in velocity andposition is still noticeable and quickly adds up.
  • The program is controlled completely by the Wiimote
  • Data is recorded about every hundredth of a second

There are a few useful examples out there performing similar functions.  I just wanted to provide another example that others can start with and that may spark ideas for other uses.

REQUIREMENTS

Hardware

  • Wiimote
  • Bluetooth USB Adapter (or an internal bluetooth device)
  • Software

  • Linux
  • Python- the programming language

    • Cwiid – Python Wiiconnecting module
    • Matplotlib – a plottinglibrary(There are other modules required that the above need, but Synaptic will find those dependencies or you just read the  documentation.

  • wiimote_record_accel_vel_pos.py- a program that grabs the accelerometer data, calculates velocity and position, and plots the results. plot them just using the wiimote
  • INSTRUCTIONS

    Just run the program and follow the on screen instructions.  The Wiimote controls the program.  Here are what the Wiimote buttons do:

    Buttons Description
    1 & 2 simultaneously Press both buttons at the same time when the program starts, so that it can find the Wiimote.
    Home This calibrates the Wiimote by recording data for 2 seconds and gettingthe average point.  All of your data will subtract this value before recording and plotting.
    + Start recording data
    - Stop recording data and then plots your results

    DOCUMENTATION

    The Wiimote provides acceleration data on 3 axis (x,y,z). The acceleration data provided from the Python Cwiid module is an integer and not a direct m/s2 or g value. I have looked a little bit online, but have not utilized a conversion factor yet, so this program just displays the output without any units.

    Data is gathered about every hundredth of a second and averaged across 3 points. So the plot resolution is about 0.03 seconds. Velocity is calculated using simple numerical integration:

      • vi = vi-1 + ai(ti – ti-1)
    • (where a is acceleration, v is velocity, t is time, i is the current data point, i-1 is the previous data point)

    To improve the accuracy of the velocity integration, the program ignores changes in acceleration below a specified threshhold. So if acceleration changes less than “x”, the velocity equals the previous data points velocity.

    Position is calculated similar to velocity. It is the integration of velocity.

      • pi = pi-1 + vi(ti – ti-1)
    • (where p is position, v is velocity, t is time, i is the current data point, i-1 is the previous data point)

    To test the data analysis I came up with a simple experiment. The Wiimote starts out at rest on my desk. I then proceed to lift it up about 2 feet and then bring it back down to the desk, and again let it sit at rest. I tried not to rotate the Wiimote or alter the x or y positions. Here are the results:

    Notice that the position does not get back to 0 even though I set the Wiimote back on my desk. This has to do with the summation of errors from integration. You can also see that even though the Wiimote is at rest at the end, the position is moving up slightly. This is due to a velocity slightly over 0. The acceleration data is good but the position and velocity data are not good enough for a real experiment, but can provide a ballpark answer. Searching online about this topic, someone mentioned that the Wii designers added the sensor bar to account for this inaccuracy.

    References

  • Wiimote interfacing using the cwiid python module – Unfortunately this link has been broken.
  • Matplotlib
  • Johnny Lee’s Wiimote projects

  • Click here to send comments or questions about this project.

    Useful Easy Button with Serial Port

    No Comments »

    Introduction

    The Staple’s Easybutton is known throughout offices for its entertaining (annoying?) “That was easy!” saying. I have seen modifications to the Easybutton where you can record your own saying or change the speed or tone of the standard voice by changing some resistors. I thought it would be great to have an easybutton that actually makes doing something easier. At work, I program a lot of scripts to automatically run data analysis, which saves a huge amount of time. I thought it would be great to have the  Easybutton run the script for me.

    This Easybutton hack is pretty simple in terms of electronics and programming. In this hack, only the switch from the Easybutton is used and that is wired to the serial port on a computer. I wrote a program in Python that looks for the press of the Easybutton and then can run any script. In addition to connecting to the switch, some of the wiring had to be disconnected because it was shorting out the switch.  Also, since we are only using this as a switch, we do not need batteries!

    REQUIREMENTS

    Hardware

  • Staple’s Easybutton
  • Wiring (2 wires minimum)
  • Male Serial Connector (9 pin Dsub connector)
  • Software

  • All Platforms
  • INSTRUCTIONS – Hardware

    Step 1: Remove the 4 rubber pads on the bottom to access the screws to take apart the case.

    Step 2: Cut battery wires and speaker wires and remove the capacitor.

    Step 3: Drill holes through the circuit board in the 3 locations shown to break the connections to the switch. Make sure to drill wide enough to eliminate the entire connection. (For steps 2 and 3 we are trying to eliminate all connections to the switch other than our own to avoid a short circuit)

    Step 4: Solder in 2 wires across the switch.  One of the wires can use the old capacitor hole and the other can use an unused hole.

    Step 5: Drill a hole in the side of the case to route the wires out.

    Step 6: Reassemble Easybutton case.

    Step 7: Connect the 2 wires to pins 4 and 8 of the serial connector.

    INSTRUCTIONS – Software

    Step 1: Run the python script or Windows executable.

    Step 2: When prompted for an Easybutton command, type “find”. Hold the Easybutton down while executing this command. The software should now have found which COM port the button is wired to.

    Step 3: Type the Easybutton command, “editlaunch” if you want to edit the command that is executed when the Easybutton is pressed. The command is executed just like using the Run utility. So to launch a certain webpage in Firefox, I would type: “firefox  http://convolutedlogic.com” (without the quotes

    Step 4: Type the Easybutton command, “start” and now the program is just waiting for the button to be pushed!

    Step 5: Quit at any time by just closing the window.

    Workdesk

    No Comments »

    I was not able to find a desk with the features that I wanted, and so I created my own.  I am not going to post detailed instructions here, but will just highlight some of the parts and features

    Features

    • Size: 6ft wide, 2.5ft depth, 5ft height
    • Work surface is a formica countertop with backstop.
    • Wide area for a chair – additional boards added to support the countertop.
    • 4 drawer cabinet on left side (this is a kitchen cabinet with the bottom removed to lower the height of the desk)
    • A small cabinet with the door removed to store a desktop computer.  (this is also a kitchen cabinet with the bottom removed)
    • A shelf across the top at about 5 ft. (not shown in the above picture)
    • LED lights underneath the top shelf (not shown).
    • A small shelf for computer monitors and other things right above the countertop backstop.
    • Below the shelf for the computer monitors and behind the backstop of the countertop is a channel for cords.  The computer monitor shelf is on hinges and flips up to access the channel.