Firmata on LightBlue Bean

Another day, another Firmata fork. I spent the last few days messing around with getting Firmata working on the LightBlue BLE Bean. I had previously written the Node NPM package for the Bean as an exercise to get to know both Node and the Bean. Why not give it full Firmata control?

My work is over at my firmata fork https://github.com/jacobrosenthal/arduino/tree/bean

The big gotchas Ive found so far are is that Punchthrough actually moved pins around in pins_arduino.h. There should be a fix for this but Standard firmata writes pins in order on the port.. So for now I’m just using the true pin names which map like so:
a0 -> a4
a1 -> a5
d0 -> d6
d1 -> d9
d2 -> d10
d3 -> d11
d4 -> d12
d5 -> d13

Beyond that I would avoid all other pins which still exist and could be hooked up to anything for all I know. This sketch doesnt protect any pins. Setting anything else very well may take your bean offline or worse..

Other than that I just added Bean.sleep at the end of loop to allow bean to sleep for power saves. Adjust to taste.

Besides resolving the pin mapping, theres plenty to be done to make this a full port. There should be a more clear Firmata Boards.h entry to show the true available pins, and in Standard firmata we might look to protect other pins from being touched. I also havent tested servo/pwm/etc functionality, especially with the sleep addition…

Note — I’ve been using firmata.js for my Node firmata needs. https://www.npmjs.org/package/firmata Though we’ve found some problems with how chatty it is out of the box. It was designed for a serial cable world and we’re quickly moving past that, though our PRs arent being accepted.  @monteslu has a fork up that we’re now using exclusively. https://github.com/monteslu/firmata/tree/nohandshake

Firmata on Spark Core

Photo Gareth Halfacree.

As part of my work with the soon to be launched Octoblu I’ve been working on porting Firmata over to Spark Core. The Spark’s arduino abstraction has really come along making it the cheapest connected arduino out there, and me pretty excited about it.

A firmata will allow us to command and control our sparks from all the existing firmata interfaces out there like Johnny 5 in Node or the many native interfaces. I should note Chris Williams has Voodoo Spark https://github.com/voodootikigod/voodoospark which is an RPC replacement for Firmata on Spark. From the Readme

"The VoodooSpark uses the Spark Cloud and its REST API to provide IP address and port information to the local spark core. It will then initiate a direct connection to the host machine, on which will need to be a TCP server. Once the connection has been made, the host machine can drive the Spark Core using the binary protocol defined below to effectively execute firmware API level commands dynamically."

That being said not relying on the Spark server or requiring you to have a TCP Server seemed like enough to bring Firmata over. Plus Ive been able to do things like tunnel firmata through mqtt which would allow Core sleep and store and forward messages that VoodoSpark currently couldnt achieve.

The StandardFirmata fork is at
https://github.com/jacobrosenthal/arduino/blob/Spark/examples/StandardFirmata/StandardFirmata.ino

While a full working branch of octoblu (nea skynet) mqtt and core-firmware is over at
https://github.com/jacobrosenthal/core-firmware/tree/skynet-mqtt-firmata

The branch is working for minor interactions, but theres still a bit to be done over at my pull request with Firmata for full upstream acceptance.
https://github.com/firmata/arduino/pull/141

Advanced Pinoccio

In doing some work recently I had the pleasure of obtaining a bunch of new http://www.pinocc.io scouts — Internet of Things Arduinos! The Lead Scout has wifi and talks to the other scouts nearby via mesh networking (non compliant Zigbee sadly). After playing around a bit I came to the conclusion that I liked the hardware. As opposed to the Spark, these are truly Arduinos. In addition to a nice webshell (via bitlash) and set of API’s you can write code as you normally would right within in the Arduino IDE. This is in stark contrast to the Spark which emulates Arduino from an as yet unfinished web IDE where libraries are largely not yet ready. It’s worth noting that I think the Spark is my long term bet, but in the short term our hackerspace has been lousy with the Spark and nobody’s doing anything with them. That said I found the prototyping shield not enough room to play in. I wanted a full development environment so I set out to create one.


How to run Pinoccio in Atmel Studio 6.2 (IE for simulating and step by step debugging):

Make sure you have the Arduino files (go with the nightly build Pinoccio recommends) installed at: C:\Program Files\Arduino

and the Pinoccio libraries and hardware installed at:
C:\Users\XXXX\Documents\Arduino

Now for the Atmel Studio setup. The full description for how to do this in general is up at Engblaze, but I’ve done the hard work and uploaded a completed 6.2 solution to Github.

Unzip it to C:\Users\XXXX\Documents\Atmel Studio\

Open it up and you should be able to simulate and debug your bootstrap code!


How to burn an Atmega256rfr2 Xplained Pro or other breakout as a Pinoccio from within Atmel Studio

Atmel makes a breakout for the Atmega256rfr2 called the Atmega256rfr2 Xplained Pro.  It doesnt have the Fuel Guage, or FTDI chip for serial communication, but its a great breakout with onboard debugger and plenty of room to work.

First, you’ll need to set the fuses. Look them up and set them in Atmel Studio.

Other than that everything is the same as above except I had to make one change to halFuelGauge.cpp because it’ll hang trying to talk to our non existent fuel gauge:

unsigned int HAL_FuelGaugei2cRead16(unsigned char address) {
int data = 0;

// Wire.beginTransmission(MAX17048G_ADDRESS);
// Wire.write(address);
// Wire.endTransmission();
//
// Wire.requestFrom(MAX17048G_ADDRESS, 2);
// while (Wire.available() < 2)
// ;
// data = ((int) Wire.read()) « 8;
// data |= Wire.read();

return data;
}

Now just burn that image.

To actually talk to the board you’ll need to add an ftdi friend

From the Pinoccio definitions we know the serial pins are RX to PE1 and TX to PE0 and black to GND.

Now you can open up your serial port and you’ll see the bitlash command prompt just like it was a real Pinoccio!

NOTE: if you want opening serial to reset the board, you’re going to have to add in the reset line. Note, however, you’ll need a .1uF capacitor between your RTS on the ftdi friend and the RSTN pin.


How to have your Atmega256rfr2 discovered by HQ as a real boy Pinoccio

This is pretty difficult. Before you go any further, know even I haven’t successfully done this yet.

First you need to buy and hook up a MAX17048 / MAX17049 fuel gauge breakout. Test without the code from the previous section commented out and make sure it all works, or at least doesnt freeze the sketch trying to find it.

Next, you need to have the bootloader burned on to your Atmega256rfr2. 

You can find a hex to burn from Atmel Studio in the Pinoccio Github and again make sure to look up and program the fuses as before.

Or you can hook up an ISP programmer using the pin definitions as guide and burn it right from Arduino, knowing it’ll get all the fuses itself.

Now that you have a bootloader you can upload the Examples->Pinoccio->Bootstrap sketch right from Arduino.

Finally you’ll need to either edit the Pinoccio HQ Chrome Extension with your FTDI’s PID and VID set to be Pinoccio (VENDOR_ID 0x1d50, PRODUCT_ID = 0x6051), or burn a new PID and VID to your FTDI with FT_Prog. Since Burning a VID and PID didn’t work for me (the drivers still didn’t really think it was a Pinoccio) I’d suggest the Chrome Extension route.

Go to Chrome Extensions, and turn on Developer Mode in the upper right corner. Then find Pinoccio. Disable it and look for its id like njhfipeehmigebbdfbingghcjdfmjeai.

On my Mac I found the files at  /Users/XXXXX/Library/Application\ Support/Google/Chrome/Default/Extensions/njhfipeehmigebbdfbingghcjdfmjeai and copied the version named folder out to the Desktop.  Windows folks should find their folder in a more Window-sy location.

Now edit the manifest.js file to add your FTDI’s vendor and product ID like so
“usbDevices”: [ {
“productId”: 24657,
“vendorId”: 7504
} ,
{
“productId”: 24577,
“vendorId”: 1027
}
]

Next, open up the pinoccio.js file and swap out the pid and vid at the top for yours.

Now, back in Extensions, click the load unpacked extension and select your file.

Lastly, you’ll need the capacitor on the reset line as described above because the Extension will want to reset the board. 

Now head to http://hq.pinocc.io It should find your device, decide its out of date, and hopefully successfully contact the bootloader to upload a new Bootstrap copy (hence the need for us to have a working fuel guage since we don’t have room to comment anything out here)

Let me know if you get this to work, as again, I haven’t!

iFirmata now in the App Store

image

iFirmata hit the Apple app store today! iFirmata lets you connect to your Arduino to your idevice via a BLE connection (Xadow or RedBear currently) using the awesome open source Firmata protocol.

It lets you connect to your Arduino and do all the things you could normally do over the wire with Firmata including digital write a pin high or low, read analog values, set PWM or servos, send i2c commands to devices or trigger custom scripts using the send string function.

Check out this hastily made video that I had to do in order to get Apple to approve it.

Of note, I put a $5 dollar price on it. Besides the months these side projects of mine are taking, dealing with the app submission is getting to be tiresome and my new resolution is to never put something in the store for free without a very good reason. If you know what Firmata is you’re probably interested and willing to throw me 5 bucks. If not its all up on Github so grab a copy and build your own. And when you’re done prototyping grab my source and make your own app. If you’re REALLY poor contact me for a promo code.

Of note, you CAN get Firmata to connect over BLE on a Mac by using 10.8 or greater and pairing your BLE device which binds a tty. However, thats a bit hacky at least for application usage. My implementation should work on macOSX with very few changes but I haven’t gotten to it yet. Send me some pull requests to kick me in the butt.

Body Jewelry / Wearable Electronics Adhesives Roundup

image

Colin and I needed to find some way to attach wearable electronics to the body for body jewelry and wearable computing type applications. Eventually we hope piercing and other body modification technologies will allow us to do permanent attachment, but despite recent articles on people using sub-dermal for the task, they’re are WAY to prone to rejection to think about hanging things off of them. Sub-dermal magnets, too, come up short currently as they destroy the skin when paired with an external magnets/ferrous objects.

So what we needed was a double sided adhesive that stuck well to FR4 PCB boards, had a foam type carrier (ie it was thick) so some electronics could sit flush, and was something we handle and package reliably.

TLDR - You can’t beat medical grade adhesives from 3M. They stick more reliably than anything else, and can be reapplied if they are removed. We sampled basically all of them and found them frankly equal for our purposes. However, only one had a foam carrier, good old 4133 med spec tape packets pk000023198. (update: these used to be called 3M Venture #7432M and you can actually find them by googling for that) After you sample they’ll refer you to a ‘converter’ who will actually die cut and or sell it to you, though we still haven’t been able to get a quote out of our local converter.


There were other adhesives worth mentioning but which didn’t fit our application for whatever reason.

We tried everything from the hardware store. Largely they didn’t work well at all:

  • 3M foam tape. Seems to be rubber and acrylic versions if you dig deep enough. Acrylic is way more common and might have seemed stronger, but not by much. Digikey stocks 4026, the stronger version, which we liked best of the hardware store tapes.
  • 3M VHB is also apparently acrylic, but didn’t work well for us.
  • Carpet tape from hardware store didn’t work at all either.

Theres also toupee tapes/bra tapes which all seem to be identical. They’re very thin double sided tapes but worked very well. Im not sure how different from any other double sided tape from Staples, so thats left as an exercise for the reader. They claim they’re hypoallergenic so the adhesive is probably not latex.

We also tried every kind of prosthetics/medical adhesives we could get our hands on. All had a similar issue for us of being unwieldy to package and apply, but would work great for any other application:

  • Pros-aide, Pro adhesive or Reel Magic (a hundred names for the same product) - a prosthetics glue used in costuming and makeup. Its thick and milky like paste. A good hold. Most claim to be latex free/hypoallergenic.
  • Tensive - A conductive gel (might be interesting for some application?) normally used for TENS/TEMs devices. Had a pretty good hold.
  • Osto-bond - Latex based so some people, surprisingly including me, might be allergic. Was pretty good though otherwise.
  • Skin tac. Very thin and watery. Leaves a tacky membrane to stick things to that wasn’t as strong as other options, but could be good for plastics or something. Also, hypoallergenic as its latex free.

Toxicity, Inclusivity, and Community Size

I’ve been struggling with the topic of toxic communication and poisonous people in our community spaces for years now. Only recently though have I been able to start collecting my thoughts and looking for answers. Today I saw that Openfly wrote an interesting article on hackerspaces.org titled "Redefining Hackerspaces" which jived well with my scribblings. I don’t want to put words in his mouth so instead I’ll quote some of the conclusion:

"We need to accept that trust networks don’t scale beyond a certain point. That trust is built on some commonality. That a community cannot be all things to all people."

I’m beginning to come to the same conclusion, that community spaces that don’t have the resources or the goal of becoming a place that pays (trained) staff CAN NOT be (radically) inclusive…

In an ideal world we should be able to communicate our grievances, work beyond our differences, simply avoid (and NOT sabotage) those who we don’t mesh with — all while still getting shit done. Sadly, our society (and thus our community spaces) don’t seem to work that way.

We’re seeing more and more toxic communication in our communities online and off. Tons of talk of twitter, reddit, hacker news, and other communities being toxic. We’ve got new newspapers and blogs removing their comments sections (finally). We’ve got every major tech conference the past few years with a big sexual harassment ‘scandal’. And in my world, huge problems in our community spaces with angry people seemingly measuring how toxic they can be against how much value they bring in.

Many people will say its just our demographic. Males, Nerds, Engineers. 18-24’s. But it sure seems to transcend into politics, religion, and all other quarters of our society. In the end it doesn’t matter, because we are in tech and thats our demographic whether we like it or not.

Ask anybody who served on the board of our nonprofit hackerspace HeatSync Labs over the past 2 years, and they’ll tell you they spent approaching 0% of their time envisioning and executing on what kind of awesome nonprofit we should be and instead spent all of their time babysitting and psychoanalyzing a CONSTANT (albeit minority) population of angry members.

Why are they so angry at this person, their project, or the way they they were spoken to? Have they tried talking to them? Have they tried not yelling at them? Have they offered to help? Were they broken up with recently? Are they having problems at work?

And thats all just to stay afloat, let alone make a dent in the problem.

As a result we’ve got the policy and administrative types screaming at us to make more rules in order to deal with all the jerks.

However, I hope we can think critically and see that rules don’t make unhealthy people healthy.

I’m not sure theres any way to make unhealthy people healthy than doing the hard work of sitting them down, forcing them to view their actions, and ESPECIALLY if their actions are getting them the results they want. And if we find that what they really want is to pain others, then we have the unpleasant (and increasingly impossible) job of removing them from our communities—rules or no rules.

Sadly all this takes energy, time, and pain which LITERALLY the opposite of why we come to communities. In fact, thats the kind of deep conflict resolution that frankly takes training and experience.

Thats why I’m starting to agree with Openfly’s conclusion that communities should not (frankly CAN NOT) be (radically) inclusive, at least not without paying staff as community managers, mediators, and at the end of the day authorities to make decisions and remove people from the community.

I’m not saying HeatSync (or your community here) have to pay community managers, but I am saying the only other option I see is to start getting less inclusive. Smaller like-minded communities (somewhere < the tribe number) who share life experiences, ways of talking to eachother, and to some extent political views will still find strife and toxic people, but are seemingly WAY more capable of communicating with eachother while still actually getting shit done— which is what we all came here for in the first place.

LED Light Strip Hacked for Haptic Motors

image

Last week I got to talk at about my most recent hack, a flexible haptic strip that easy for anyone to use, at Hack N Tell Round 25 in NYC.

In between working for ASU’s Cubic lab on a new haptic strip, I was pondering ways to bring haptics more to the forefront. Sure you can buy a bare motor or lilypad motor from Sparkfun or elsewhere, but in practice they’re a total pain to get working. You need a transistor and its a pain to mount them anywhere you’d want them — Especially when motors are only really fun when you have a few of them to play with. And lets not even address the cost of say 10 of these modules!

Then it hit me that the cheapest motor driver chip I could buy would be the <14cent WS28XX series LED drivers that get used on LED light strips!

Now, it’s not necessarily THAT novel to use LED drivers to drive motors. Many people, including myself, have done it before, but I realized theres no reason I couldn’t use the same flex PCB process as LED strips as a form factor as well.

I don’t yet know how to do flex PCB, and theres is no OSHPark for flex PCB yet :) (paging laen) So I just found an LED strip on ebay that used a common driver chip I liked, that wasn’t integrated into the LED which is really common nowadays, and wasnt potted with epoxy or anything.

image

The strips don’t need many changes for motors. Just pulled the LEDs off and put a motor across one of the 3 channels, top to bottom. You can also add a little LED across one of these channels as well to get visual notification. Finally you’ll want to use a multimeter to figure out which resistor hooks up to the motor so you can swap that resistor off for a shunt—You’ll want as much current as the driver chip can give you. In the future you may want to add some motor protection with a flyback Schottky diode across where you put the motor to protect the LED driver chip.

The additional beauty is theres already a great Arduino library called fastSPI to run these! Just follow the directions for LED light strips. SCK to Pin 13, SDA to Pin 11. They should work on 3v or 5v but I’ve been running mine at 3v with more wearable Arduinos like the Xadow and Fio V3.

And just like LEDs you can simply cut the strip anywhere you want, from 1 motor to 32, your choice!

We’ve tried them in baseball caps and arms and legs. I think they’d work well sewn into a bag strap. Let me know what form factor you try! And hopefully in the future I’ll be able to get them produced for cheaper than hacking them from ebay :)

Lasering PCB enclosures

This week I used the laser to cut some holes in my enclosures to make way for switches, light pipes, etc. My previous attempts pre-hackerspace (with a dremel) were.. rough.

There had to be a better way! The big problem with using the laser was jigging the case in the laser in such a way that I could reliably and repeatedly cut in the perfect spot. After a few attempts I found a solution.

image

First I exported my front board dimension and mill holes from Eagle using run -> dxf.ulp, opened it in our laser program, mirrored it and adjusted some holes and sizes.

image

I grabbed a square piece of stock and dropped up the in the upper corner of the laser and homed the laser head. Now, by lasering that outline on my stock, I can take it out of the machine and put it back in the same place every time.

image

I can also match the PCB up over the top of the etch.

image

And, finally, since the PCB is designed to fit the case perfectly, I can just drop the case on top of the PCB.

image

Wonderful. I could still use a method to cut cleaner on the other 4 sides, but for now Im happy doing a little bit of clean up work and having my cuts be entirely though the case.