BrewBot: Sending Coffee Notifications to Slack

At work, we have a coffee machine that serves dozens of people in the building, and it’s difficult to know when to come get fresh coffee. You might arrive when it’s empty and be tasked with making more, but the ideal situation is to arrive just as a fresh pot is being brewed.

We also use Slack for team chat and various notifications, so integrating the coffee machine status was a no-brainer. Using a non-invasive/inductive current sensor and Raspberry Pi, the following setup monitors coffee machine energy consumption and waits for a significant rise in current draw, followed by several minutes of sustained usage. Once a time threshold has passed, it does an HTTP POST to a Slack webhook, sleeps for about 15 minutes, then starts monitoring again. This “brewbot” code is available on GitHub, and a parts list can be found below.

full_kit

box

adc_board_front_and_back

Full parts list:

Related reading: Hyper Text Coffee Pot Control Protocol

Advertisements
BrewBot: Sending Coffee Notifications to Slack

Widerbug 1.3.0 for Firefox 3

The Firebug team has been hard at work squashing bugs and making Firefox 3 related improvements, culminating in the release of Firebug 1.3.0 yesterday. Some of the notable changes include:

  • Better debugging performance when dealing with large JavaScript files
  • More reliable ‘console’ object for logging
  • Alphabetized DOM properties
  • Added localizations
  • Over 50 bug fixes

After some minor modifications, Widerbug 1.3.0 is ready for use on your widescreen display in its signature 2-up layout, complete with all the changes from above. As usual, head over to the Widerbug page to grab the latest version (please leave comments and note any bugs on that page).

Widerbug 1.3.0 for Firefox 3

fmTuner: A Last.fm Plugin for WordPress

fmTuner is a WordPress plugin for retrieving song details from your Last.fm profile and publishing them anywhere in your WordPress theme. It provides options for choosing among your Recent, Loved, or Top tracks, as well as tools to adjust the update frequency and appearance.

Of particular note is the customizable Display Format option. Using simple tags like [::artist::] and [::image::] intermixed with regular HTML, you can tweak your Last.fm tracks exactly how you like, or however your WordPress theme requires. You have full control!

Download

Download the latest fmTuner from WordPress.org

Requirements

  • WordPress 2.7 or newer.
  • PHP 5 or newer
  • Basic knowledge of PHP, HTML, and WordPress.

Installation

  • Upload fmtuner.php to a directory inside /wp-content/plugins/ directory. For example: /wp-content/plugins/fmtuner/fmtuner.php
  • Ensure /wp-content/plugins/fmtuner/ is writable by your webserver.
  • Activate the plugin through the “Plugins” menu in WordPress.
  • Set up options in the “Settings” menu in WordPress.
  • Place the PHP code if(function_exists('fmtuner')) { fmtuner(); } in your templates, to call up fmTuner.

Release History

  • fmTuner 1.1
    Released on Feb. 1, 2010
    Added a placeholder image field to the fmTuner Settings page, which will be substituted when tracks have no artwork.
    Tested under WordPress 2.9.1.
  • fmTuner 1.0.8
    Released on Nov. 3, 2009
    Fixed a bug with the [::url::] fmTuner tag that caused Last.fm links to appear incorrectly.
  • fmTuner 1.0.7
    Released on Apr. 23, 2009
    Tracks with foreign character sets now display more accurately.
  • fmTuner 1.0.6
    Released on Mar. 29, 2009
    You can now display more than 10 Recent Tracks, and you should get fewer tracks without artwork.
  • fmTuner 1.0.5
    Released on Mar. 22, 2009
    Track information is now properly escaped to handle $ signs, quotes, and other non-alphanumeric characters.
  • fmTuner 1.0.4
    Released on Dec. 14, 2008
    Made minor tweaks for fmTuner Settings page under WordPress 2.7.
  • fmTuner 1.0.3
    Released on Nov. 15, 2008
    By request, a [::number::] fmTuner tag has been added, which emits a sequential number for each track (starting at 1). This is particularly useful for CSS and JavaScript display purposes.
  • fmTuner 1.0.2
    Released on Oct. 5, 2008
    Added a cURL-based alternative to file_get_contents to hopefully resolve “URL file-access is disabled” issues. If allow_url_fopen is disabled in the php.ini, cURL will be used to fetch the Last.fm feed instead.
  • fmTuner 1.0.1
    Released on Sept. 9, 2008
    Added better failure checking and informational messages, removed development code, and updated instructions.
  • fmTuner 1.0
    Released on Sept. 6, 2008
    Initial release.
fmTuner: A Last.fm Plugin for WordPress

iPod Junior

Back when Command-Tab first started, I did a hack where I managed to connect a full size hard drive to a 3G iPod. I’m happy to present today a much easier solution — the “iPod Junior” — using a laptop hard drive and a nearly pre-built adapter. The end result is an iPod with an attached 2.5″ hard drive with next to no soldering.

In my earlier hack, I noted that the 1.8″ hard drive inside the iPod runs on 3.3v (see for yourself) instead of the 5v used in slightly larger laptop drives. Again, some external power source will need to be connected to power the drive, as the iPod alone can’t even spin up the laptop drive, much less a full desktop-sized drive. What I discovered is that the hard drive caddy inside IBM ThinkPad 240 laptops are almost a perfect iPod-to-laptop drive adapter, with the exception of power. On the front of the adapter is a female 1.8″ hard drive plug normally used for connecting to the laptop bus, and on the back is a standard female laptop hard drive connector. With some slight modification to route in the correct power, this modified adapter can easily attach a laptop hard drive to your iPod’s ribbon cable — ready for formatting and use.

You can see more photos of the modification in my Flickr photoset. To do the hack yourself, you’ll need to acquire a ThinkPad 240 hard drive caddy off eBay, like I did. Cut the +3.3v power trace that leads to pins 41 and 42 on the 2.5″ hard drive bus, and also scrape some of the green coating off both positive and ground traces. With the positive lines cut and some bare copper exposed on both traces, you can then solder on whatever power connector you prefer to run 5v to — I used two simple pins from a pin header, as a floppy drive power connector will easily plug onto them. From there, connect everything up, power up the drive, and then the iPod. Format and use. Rinse and repeat.

iPod Junior

iMac LC III


Things have been a little slow around here because I’ve been dedicating a bunch of time to my latest project — disassembling a grape iMac and fitting its parts into an LC III case. I’m finally done now and am happy to report that it was a complete success. It required more hardware modification than I had initially anticipated, and I ran into some problems along the way, but without those troubles I wouldn’t have made it to this point. What follows is a step-by-step of what I did to cram a big gumdrop shaped iMac into a pizza box sized LC III case.

iMac Without It's Candy ShellSeveral weeks ago I received a dead grape iMac from a MUG member who suspected that the power supply had bitten the dust. I had previously agreed that I would take the iMac in trade for retrieving the files off of the hard drive…which was a fairly easy task thanks to an IDE-to-FireWire bridge out of a hard drive enclosure. Since the power supply was useless, I couldn’t easily tell what else on the iMac worked. I disassembled the candy colored machine and salvaged the logic board, video board, speakers, microphone board, hard drive, and case. With all the major useful components laid out, I set to doing a little research on the net.

I found several useful iMac hack pages, including one (saved copy) which detailed the power connector on the bottom of the iMac’s logic board. Attached to the board is a power filter, likely because the power supply is very close to the (electrically) noisy cathode ray tube inside the iMac case. Since I wouldn’t be using the same physical configuration, it most likely wasn’t necessary.

Digging around in my array of old computers, I found a Macintosh LC III which no longer worked. I decided to challenge myself and see if I could fit the iMac’s components into it. The LC III is a dream to take apart compared to the iMac — the back of the case has one screw, then two snaps. The top then easily lifts off to reveal all the parts. Since the LC III was already defunct, I just removed all the parts from the case and set them aside.

I began placing the iMac’s components into the LC III case to get a general idea of where they might fit. As far as I could tell, all the parts would fit within the area of the case, but height was another issue. The case only provides a little over an inch of vertical space, so I had to keep everything very low profile.

Booting the Motherboard with an OS X CDThe first issue I ran into was power. Since the iMac’s power supply was dead, I couldn’t use it’s board, not to mention the fact that it was gigantic and would take up far too much space. On the iMac to ATX conversion page I found earlier, the author detailed how to adapt a standard PC ATX power supply to an iMac. Following his diagrams, I built a small adapter with a female plug and pin header, which would connect an ATX power supply to the bottom of the iMac’s logic board. With the adapter built, I carefully checked my connections — you only get one shot with this type of work. Borrowing a spare ATX power supply, I powered up the iMac logic board. While it had no magnetic or optical drives connected, it still made the familiar Mac startup chime and displayed a blinking question mark, indicating it could not find a system folder to use. I’d never been so happy to see that symbol before. I quickly powered it down and attached the iMac’s CD-ROM and let it start Mac OS X 10.3.5, which also booted just as easily.

After having complete success with the logic board and power supply, I moved on to the optical drive with a good feeling that I may actually accomplish something with this project. I noticed that the LC III had a lot of spare room around the floppy drive, and I thought it would be a perfect spot for a CD drive. However, the slot facing the front wasn’t wide enough for a CD. With a little filing and sanding, the slot was wide enough to accept any disc, and has the benefit of still looking stock to the untrained eye. After that, I spent the next few hours modifying a slot-loading DVD-ROM so that it sat at the proper height to catch an inserted CD or DVD. The hard drive would stay in the same cradle as it was in the original LC III design, and required no modification to make it fit.

IDE Cable FoldingThe biggest task in this project was to clear out most of the raised plastic squares on the bottom of the LC III case to gain an extra quarter of an inch under the motherboard and power supply. Between Dremel grinding wheels, pliers, and some sandpaper, I was able to knock out enough plastic to allow the IDE cable to sit comfortably against the bottom of the case without raising the motherboard any higher. The power supply was another issue — I scavenged a small 120 Watt ATX power supply from an old PC tower and carefully stripped it of its protective metal housing. With the small height gain, the power supply just barely fit inside the case and pressed snug against the imac logic board, holding everything in place. It wasn’t perfect, but it would do.

Drives and CableA final problem I ran into was that the connector on the back of the slot-loading DVD-ROM was on the opposite side of most laptop drives, meaning that my IDE adapter board would stick way too far outside the case. This problem had me stumped for a long while, but I eventually came up with a hack to make it work. I cut a hole in the bottom of the DVD-ROM and moved the main controller board *under* the drive, and ran the ribbon cable to it. This way, I could turn the board 45 degrees and make use of the IDE adapter, although at an awkward angle. Doing this modification also required that I re-run some motor control and switch wires on the drive.

Finished iMac LC IIIFinally, with all the major modifications complete, I carefully fitted all the components into the case, ran power and data wires to the drives, and attached the audio and video cables. While all my hacks had worked throguhout the process, I still half-expected the whole mess to go up in smoke when I powered it up. Yet, when I flipped the switch, the machine slowly came alive. With some final modifications to add a small processor fan and proper AC connector, my iMac LC III is now happily running Mac OS X 10.3.9.

All pictures of the process are available at my Flickr photostream under the imac tag — I would post them in my gallery here, but I still have yet to subscribe to Flickr Pro. When I do, I’ll create a photoset, and that group will appear here. If anyone is willing to donate a Flickr Pro account, it would be greatly appreciated :-) Until next time, happy hardware hacking!

Update: I’ve subscribed to Flickr Pro, and the iMac LC III photoset can be viewed here.

iMac LC III

Apple ADB Mouse Conversion

Here’s a little hack I did not long ago during the course of a weekend. I opened up an old, blocky Apple ADB mouse and swapped the internals with that of a newer USB mouse.

Unlike today’s injection molded, glued together, snap shut technologies, the Apple ADB mouse was no problem to open, with just had 4 standard Phillips screws on the corners of the underside. With the mouse open, two small circuits are visible. The circuit near the front of the mouse is where the pushbutton for clicking resides, and the other board tracks mouse ball movement and the ADB interface. Interestingly enough, the chip inside the Apple ADB mouse was made by Logitech, whose 2-button wheel mice I swear by today. I separated the two boards so that I could use the same pushbutton on the “new” mouse guts — the Apple ADB mouse has a distinct click, and I wanted to maintain that classic feel after the conversion.

Opening the USB mouse (an IBM one I bought a while back but didn’t like the feel of) was just as easy. After locating the left-click pushbutton and tracing the wires to the main board, I marked the points with a permanent marker and cut the ribbon cables, separating the USB mouse’s two boards as well.

The next step was to combine the old Apple pushbutton with the main board of the USB mouse. Since I marked the two points where the USB mouse was expecting a left-click switch to be attached, I soldered wires from the Apple switch to those points. In hindsight, I should have checked and made sure that both switches (old and new) were normally open or normally closed, but I got lucky — they matched.

The hardest step in this whole hack was cutting the right size and depth hole in the bottom of the Apple mouse plastic so that the optics of the USB mouse could fit and work properly. After much dremeling and hot glue, I was able to get the USB main board in a place that was stable and could “see” the desk. After testing the optics and mouse pushbutton, it was time to close the little guy up. I dug up a USB cable left over from another project that actually matched the Apple mouse color, attached it, and routed it through the hole used by the old ADB cable. A little more hot glue to keep everything in place, and I closed it up and put the original screws back. It’s not very pretty on the bottom, but it works. Not bad for a two or three hour weekend hack, I think.

Apple ADB Mouse Conversion