Introduction: Hello, Velo: the Internet of Two-Wheeled Things

Picture of Hello, Velo: the Internet of Two-Wheeled Things

As a Maker-in-Residence at Kinoma this summer, I knew I wanted to make something that would work, not necessarily as a product, but as a device to solve a problem one of my friends was having. I wasn’t sure what the problem was, or who the friend was, so I started my summer by making a post on Facebook briefly describing my hopes for the summer asking all my friends what kind of things, even crazy things, they would like to see as IoT products.

I got a wide range of answers; everything from a washing machine that alerts its owner when the cycle ends to special sports equipment which tracks ball motion and contact. The one I was most compelled by, though, came from a friend of mine in Amsterdam---where 63% of residents use their bicycles on a daily basis----and dealt with a problem that I myself have experienced:

Janneke: could you build a collar for my bike so I always know where I've parked it, and let Tijs know when to expect me home for dinner?

I got to work designing Hello, Velo. You can see it in action in the video above. As the video describes, it has a few cool functions:

  • you can text it at any time, and it will reply with a google maps link to its current GPS coordinates
  • it can detect when you are heading home and send a message to your significant other with your ETA
  • it's stylish, and you will have made it yourself. :)

So let's go!

Step 1: Gather Your Materials

Picture of Gather Your Materials

Hello, Velo requires several pieces of physical tech to work:

  • Kinoma Element ($24.95)
  • Adafruit FONA board ($39.95)
  • 2x 500mAh+ LiPo battery (1200 mAh for $9.95; bigger batteries will be harder to fit in the enclosure!)
  • PowerBoost 500 ($14.95)
  • uFL GPS Antenna ($3.95 for the slightly larger, more accurate one)
  • uFL GSM Antenna ($2.95) OR SMA GSM Antenna + SMA/uFL adapter ($8.90; Adafruit was out of the other one when I went to order parts :( )
  • 2G SIM card ($9.00 + service charges; note that the board requires a 2G SIM, and that this SIM will only work in the USA! Adafruit has a longer discussion about how to get a SIM for your FONA. When you're deciding on a plan for your SIM, it may be worth considering that this project only uses text messages and no voice calls or data.)
  • 3D Printed holder, back, and collar
  • machine screws (2x #6 machine screws + nuts for mounting, 4x #6 for closing case, 2x #3 for attaching FONA inside)

The total for all the physical hardware is in the neighborhood of $100.

For the software side of things, you'll need Kinoma Code to get the software up and running on your Kinoma Element. You can download the software using the zip file on this step, or find it on the Kinoma github repo.

For the 3D printed parts, you can find them on Thingiverse. You can measure your bicycle's stem size to fit the collar precisely to it. As mentioned on the Thingiverse page, the orientation for the back is important as you need to print the clip as sturdily as possible. I printed all the parts in PLA, but ABS would be just fine if that's what you've got access to.

Step 2: Assemble the Digital Pieces: Getting Up and Running on Kinoma Code With Kinoma Element

Picture of Assemble the Digital Pieces: Getting Up and Running on Kinoma Code With Kinoma Element

If this is your first time using Kinoma Element or Kinoma Code, read this section! If not, go ahead and skip to "Configuring".

Once you've got Code downloaded and installed, it should be ready to go. You can check out Kinoma's website to learn all the neat stuff it can do!

If you're using your Kinoma Element for the first time, you'll have to get it configured. You can use Kinoma's official instructions, but it's quite easy and the gist is as follows:

First, plug it into power (it doesn't right now matter if you have the FONA, etc., attached to it) with a MicroUSB cable. This can be power off your computer, or off the wall.

Now, look at the available WiFi networks list on your computer. You should see something called Kinoma Element-xxxxx (where xxxxx is some numbers). Connect to that network. Your Kinoma Element should show up in Code as you can see in the image.

Using the top icon in the left bar (marked as Configuration in the first picture), go into the WiFi configuration. You can select your desired network and enter the password. Now, anytime your device boots up, it will automatically connect to that network: when your computer is also attached to that network, you'll be able to wirelessly upload code to the Kinoma Element!

Step 3: Assemble the Digital Pieces: Configuring

There are a few things you'll need to configure to get this code up and running. Go ahead and open the project you downloaded using Kinoma Code.

You'll need to get a Google Maps API Key, which you can get from their API Console. Click on "Enable and Manage APIs", and create a project with a name of your choosing. It may take a moment for Google to create the project, but this isn't a big deal. The easiest way to get the right kind of key added to your account is to then go to the Google Maps API website and click "Get A Key". Then, select the project you already created and click "Enable API". It will think for a moment and spit out your API key. Put this key into apikey.js where it says "YOUR API KEY HERE".

Now you'll need to set up the phone numbers and locations that you want to use with the system. You'll need to modify a few variables in main.js, but first we have to figure out what to put.

Go onto Google Maps and determine what you can search to reliably get you your work and home as a result: for Marvell, where the Kinoma team sits, I use "Marvell, Marvell Lane, Santa Clara, CA". Then, you'll also need to get the GPS coordinates of these locations. For my desk at Marvell, that's 37.4116919,-121.9836436 . Put your results into configuration.js:

var WORK = { name: "Marvell, Marvell Lane, Santa Clara, CA", location: { latitude: 37.4116919, longitude: -122.9836436, }, };
var HOME = { name: "your home address", location: { latitude: 00.000000, longitude: 00.00000, }, };

We still have a couple more changes related to phone numbers. Fix up these variables as you like:

var OWNER = { name:'Your Name', number:'xxxxxxxxxxxx', };
var SO = { name:'Cutie Pie', number:'xxxxxxxxxxxx', };
var BICYCLE = { name:'Velocipedoria McWheelsie', number:'xxxxxxxxxxx', };

"OWNER" is supposed to be you: this will be the only person who can query the bike as to its current location. "SO" is your significant other: this person will be notified when you are heading home from work. "BICYCLE" isn't really used in the code, but it may be handy to keep the phone number of your SIM card in an easy-to-find place.

There’s lots more that the FONA board can do that isn’t implemented for this project, but the library included in the code covers FONA initialization, GPS-based location checking, SMS sending and checking, and a few other handy things.

If you're curious about what the code is doing, you can take a look at my quick technical walkthrough (the video linked above).

Step 4: Assemble the Physical Pieces: Kinoma Element & FONA

Picture of Assemble the Physical Pieces: Kinoma Element & FONA

The FONA board is first. We slide our SIM card into the holder, snap it closed, and flip the board over. Then, attach the GSM and GPS antennas to the board (there are tiny legends in the silkscreen on the board showing you which one goes in which place). Plug in the LiPo. Adafruit also has more in-depth instructions if you want them. Finally, wire the FONA to the Kinoma Element. In the code I've provided, I use the following pins from Kinoma Element to FONA:

  • 9 -> Vio
  • 10 -> GND
  • 11 -> RX
  • 12 -> TX
  • 13 -> Rst
  • 14 -> Key

If you want to test out your FONA before wiring it up (always a good idea), you can solder on header pins and use a USB console cable. This saved me 1,000 headaches in writing the library!

Now we need to get some mobile power to the Kinoma Element. To do this, first unscrew the Phillips screw on the back. When you open it, you'll see something like in the photo: you want to hook up the battery lines to the pins marked in the last image (GROUND and VSYS). Take your PowerBoost module and attach its 5V pin to the VSYS pin on the Kinoma Element. Attach the GND pin next to the 5V pin on the PowerBoost to the GROUND pin on the Kinoma Element. Plug in the LiPo to the PowerBoost. If you want, you can try smushing the wires back into the lovely green-and-white case so that your Kinoma Element looks just like new, but this isn't necessary. If you aren't re-encasing it, be careful to cover the backside in electrical tape so that when you start putting more components on top you don't short-circuit anything.

Finally, make sure to plug in your charger boards: the LiPos are wired to charge off of the USB hookups. Keep 'em plugged in while you assemble everything else.

Step 5: Assemble the Digital Pieces: TEST

While we have all the pieces laid out so nicely, it's worth our while to make sure everything's working right before we seal it away forever in 3D printed plastic.

There are 4 major things you'll want to test:

  1. Is everything hooked up properly?
  2. Do you have the right phone numbers in your code?
  3. Is your GPS detection working?
  4. Can the FONA read text messages from your SIM card?

To determine if the phone numbers are right, change main.js so the function start(configured) is as follows:

start(configured) {
if(configured) {
trace(">>>> configured! setting up polling...\n");
clearInterval(configurationWaitInterval);
Pins.repeat("/FONA/getGPS",3000,GPS=>this.onGPS(GPS));
Pins.repeat("/FONA/getMostRecentSMS",10000,SMS=>this.onSMS(SMS));
this.sendSMS(configuration.OWNER, "Hello, Velo!");
this.sendSMS(configuration.SO, "Hello! I am " + OWNER.name + "'s Velo!");
} else { trace(">>>> not configured.\n"); }
},

Once that is running, send a message to Hello, Velo's phone number: say "where did I park?". Within a few seconds, it should respond with "I am parked here: ". Open the link on your phone, and verify that it points to your current location.

Also, you and your SO should each receive a text message. Yours should say "Hello, Velo!" while theirs should say "Hello! I am your name's Velo!".

If all of those things happen, you're good to go. If not, try checking the following things:

  • are your connections between the FONA and the Kinoma Element correct and sturdy? Double-check!
  • is there a solid blue and blinking red light on the FONA when the Kinoma Element code is running? (if you have the charger cable plugged in to charge the LiPo, there will also be a solid orange/yellow light) If not, you may want to check that everything is wired up right. If it is and you're still having problems, wait a bit for the LiPo to charge and see if that fixes the problem. If not, try wiring your FONA to USB and issuing it commands directly to see if there is a problem with the board.
  • does the console (at the bottom of the editor) in Kinoma Code say anything that seems odd? My code should output errors when it can figure out something is going wrong. Look in the console for lines that say "failed" and similar things. One thing that could cause problems is plugging the GPS antenna into the GSM antenna slot and vice versa; they use the same connectors so this could be a good thing to verify. Other potential problems include: no GSM signal (if you use the same carrier for your regular phone as you use in your FONA, check if you have reception), no GPS signal (are you deep inside a building or basement?), and wrong numbers input (did you double-check your number and your SO's number?).

Step 6: Assemble the Digital Pieces: Set the Hello, Velo App to Open When the Kinoma Element Boots

Picture of Assemble the Digital Pieces: Set the Hello, Velo App to Open When the Kinoma Element Boots

Once everything is working together happily, we need to set the app to start up as soon as the Kinoma Element is powered. (We aren't always going to have our laptops connected to Hello, Velo when it's attached to our bicycle!) For this, we'll use the serial console.

To use the serial console to Kinoma Element, you can do one of two things: plug it directly into your computer, or use screen/putty to connect to it remotely. You'll use the same commands for both ways.

Plugging directly in: in Kinoma Code, you can look at the drop-down menu of available devices. In this list, you'll see a usb modem (see image). While you want to have the Kinoma Element itself selected to upload code, this time we'll select that modem which gives us a command line to access the device.

Connecting remotely: using your telnet client of choice (e.g., screen or PuTTy), connect to the IP address of the device on port 2323. More detailed instructions are on the Kinoma website.

Once you're connected, you want to type the following commands:

setenv APPLICATION main

saveenv

reboot

This should set your Kinoma Element to boot into the application (note that you should use whatever you called the project in place of "main" above, if you changed the name of the file from main.js to something else).

Step 7: Assemble the Physical Pieces: Bike Mount

Picture of Assemble the Physical Pieces: Bike Mount

Did you already print the Thingiverse files from Step 1? Great! Let's get on with this, then.

Oh, you didn't? Well, be prepared to wait about 8 hours while they print. Maybe you can cross a few things off your GISHWHES list, or save some animals while playing Pokémon Go (or do both). By the way, the dimension of your bike that you want to measure for printing the "collar" part is the radius of wherever you want to mount your Hello, Velo. My bike happens to have almost no round profiles; the only place I can put it is on the seat post. You could also try the top tube if yours is round, or the stem (right behind the handlebars). I recommend leaving a few extra mm of space in your measurement to include rubber or another material as a non-slip piece.

I printed the three parts in different colors to make it easy to follow what's going on in this step (though they are painted for the final product). The dark blue piece is the "holder", the light blue piece is the "back", and the silver piece is the "collar". For my final version, I sanded all the parts and spraypainted them with "Candy Green" spraypaint.

First off, stick your Kinoma Element in the holder with the logo side facing towards the hole in the front of the big mount piece. For best fit, you'll want the wires coming out on the opposite side as the standoffs for screwing in the FONA.

Now place the FONA on top, aligning its holes with the standoffs. Carefully screw it in with#3machine screws.

The GPS antenna (assuming you got the 15x15x15mm one instead of the 9x9x9mm one) should fit snugly in the square recession. Pop that in there.

The battery should be placed carefully on top of the FONA, oriented with its length along the minor axis of the ellipse, and the GSM antenna tip should be able to slot into the round recession (be careful not to bend the end of the wire too much as you do this; it's a tight fit!).

Grab the back and slap it on. Use four #6 machine screws to tighten it onto the case.

Fit the collar around whichever part you measured. Use two more #6 machine screws and nuts to tighten it to the back.

Step 8: Try It Out!

Picture of Try It Out!

It's ready! You can now use your Hello, Velo to keep track of your bike. Hopefully it's of some use to you, or at least taught you something in the process of building. :)

My wishlist for future features:

  • waterproofing! Right now, this is ok in drought-ridden California where I live, but probably won't cut it elsewhere.
  • rechargeability! Having to partially disassemble the thing to charge the LiPos is kind of a pain... a future redesign of the case should include an access for this (though it may be at odds with waterproofing). It would also be nice to have power indicator lights to cue you to charge it when needed. Also in this vein, it would be nice to use just a single battery to power both parts of the project.
  • theft prevention! Right now, this device can be removed by simply unscrewing. This makes it easy to take off and recharge, but may be a problem if you wish to own it for a long time.

Comments

good_apollo (author)2016-08-23

Wow, this is super impressive! I really enjoyed watching and reading about your process. Everything from the parts sourcing to the programming parameters. It's clear that this project was well thought out. I think that even though there may already be apps that can set locations/take you back to where you parked, the idea is more than that and could easily be adapted or tweaked to fit many different applications (not just bicycles) where this location based automated/hands-free solution would work awesome. Well done.

thank you! it would be fun to see what other tasks it could be adapted for. I feel it could still use one more full iteration to be truly ready for the street, but I hope that at least component-wise it is helpful for others to build off of!

3366carlos (author)2016-08-20

wow, too advanced for me

tomatoskins (author)2016-08-19

What a cool idea! Thanks for sharing!

About This Instructable

2,382views

44favorites

License:

More by valkyriesavage:Hello, Velo: The Internet of Two-Wheeled Things
Add instructable to: