Tag Archives: tips

SMS gateway to Cosm using Tropo

Here I present a terrible way to use Tropo to create an SMS gateway to Cosm feeds while waiting for the official Cosm SMS gateway to exit beta status.

This stores your Cosm API key in plain text (I don’t know how to avoid this) so it is a terrible solution, but a very easy one.

Background

I read http://cosm.com/docs/quickstart/curl.html
curl --request POST
--data '{"title":"My feed", "version":"1.0.0"}'
--header "X-ApiKey: YOUR_API_KEY_HERE"
--verbose
and
http://api.cosm.com/v2/feedshttps://www.tropo.com/docs/scripting/capturing_incoming_text.htm
currentCall.initialText

How to translate that into python? See http://stackoverflow.com/questions/111945/is-there-any-way-to-do-http-put-in-python.

The app

Create a new Tropos application and use a hosted file.
** If you don’t know how to setup Tropo to do the following, see Appendix 1.

File Name: smstocosm.py
File Text:

import urllib2

val = currentCall.initialText
say(val)
test = ('{ "version":"1.0.0", "datastreams":[{"id":"potvalue", "current_value":"%s"} ]}' % val)
contenttype = "X-ApiKey"

#Edit to your Cosm api key and feedurl,
apikey = "COSM-API-KEY"
feedurl = "http://api.cosm.com/v2/feeds/YOUR-FEED-NUMBER"

opener = urllib2.build_opener(urllib2.HTTPHandler)
request = urllib2.Request(feedurl, data=test)
request.add_header(contenttype, apikey)
#request.add_header('Content-Type', 'your/contenttype')
request.get_method = lambda: 'PUT'
url = opener.open(request)

This file can later be edited at https://www.tropo.com/hosting/.
** If you don’t know what your Cosm Api Key or feed URL is, see appendix 3.

Now add a new phone number for your app.
** see appendix 2 if you’re unsure how.

Text that number with a value (e.g. “45”). Wait a few seconds and Tropo will text you back that same value (acts as a confirmation message that Tropo got it). Then wait another 30 seconds or so and refresh your Cosm feed URL. Voila! Your new value shows up there.

Todo next for me, connect a pot to an Arduino Uno + GPRS shield from Sparkfun, have the pot values sent to Cosm via SMS.

===

Appendix One.

https://www.tropo.com/docs/scripting/creating_first_application.htm
1) Start by clicking on the “Your Applications” Quick Link.
2) Click on the link to Create New Application near the top right of the new page.
Click on the Tropo Scripting icon.
4) For Tropo Scripting Application Name, enter in a name like Tropo Test.
5) Click on the “Use a Hosted File” link and choose “Create a new hosted file for this application”.
The File Name can be whatever you’d like, it just needs to end with the language extension you intend to use (.rb for Ruby, .php for PHP, etc). For the File Text, see above.

Appendix Two.

8a) To the right of the Skype phone number is an “Add a new phone number” link – go ahead and click on it.
8b) Select your preferred area code and then click the + sign next to the area code to add it to your application. Click the X at the top right to close the window and you’ll be returned to your application settings page.
9) That’s it!

Appendix Three.

Note: If you don’t have an API key for Cosm yet, follow http://community.cosm.com/quickstart_no_code (actually that is for the old pachube interface, I updated it for the new Cosm interface below):

Login to Cosm and click on “Keys” in the top right corner (or go to https://cosm.com/users/USERNAME/keys, where USERNAME should be replaced by whatever username you chose when you signed up).

Click the blue “+key” button (https://cosm.com/users/USERNAME/keys/new)

Give it some label, select “use any public feed”, and select permissions options ‘read’ and ‘update’ (because you will want to use this key both to retrieve and to update Cosm datastreams). Ignore “advanced restrictions”.
Click “create”.

After clicking “Create” note down the feed ID that you have just created (e.g. http://www.pachube.com/feeds/15556 would be feed ID 15556).

how do I machine shop [at MIT]?

sup dawg heard you’d like to machine things at MIT, here’s what’s up:

Step 1: Get inside the TARDIS

source

Step 2: Arrive in China

Step 3:  Make friends in China and tour factories

Okay I lie. this is actually a machine shop and not a factory, but here be precision prototypes ala Charles’s outsourced hubmotor casings made
Also, protip: if you ever do visit a factory, don’t be like me and pretend to be a factory worker and **** up all the parts while working 5x slower than everyone else >__<;;;

Step 5: profit!!!11!!


… …
Ehem.

Oh right. Sorry. I’m supposed to not fail 2.671 and graduate so I will start on MIT machine shops now.  First, I’ll overview the generally accessible shops, then I’ll go over waterjet / lasercutter access. In particular, I will address this as a major-neutral FAQ instead of a pictorial / virtual tour of machine shops around campus.

Q: How do I learn to machine?
A1: Edgerton shop training. 
Sign up for the Edgerton shop training waiting list right now. Seriously, right NOW. All you have to do is send a measly email and it takes upwards of a semester to get off the waiting list.

“The monthly training program is conducted in the evenings and consists of twelve hours of hands on instruction, showing the basics of milling and lathe work by making two small parts”

At the end you even get to take home this beauty which you created from stock rod and bar:

source

It’s also IMHO much more actually useful than your two weeks of 2.670 (which are more like “heyyy guys check out these tools at your disposal, j/k we set them up for you) or even 2.007 and 2.008 if you don’t take the initiative and swim counter-current, the shop guys (bless their hearts) will do a lot of the setup work for you in order to keep the class running smoothly (esp. toward the end of semester, when you know what you want to do but so does everyone else).

When I took 2.007 I contemplated taking advantage of my free time / their free time early in the semester, but was told they wouldn’t tolerate non-class projects “just to learn machining.” I now think that’s false, but it’s still nerve-wracking for someone like me to just go up to them, esp. since at the time I didn’t know what sort of beginner level projects I could try out just for fun, so I just ended up skulking around MITERS.
 
A2: Take “How to Make (Almost) Anything“. 
This is much more of a crapshoot, as it’s offered only 1x a year to 40 people (usu ~150 people apply). However, they actively try to create a “class” of different background each year: undergrads, grads, architecture, media lab, no “making” experience, machining experts, all have a chance of getting in.

For reference, this is the prof on CNN and at TEDtalks, and this is the class website as well as the subject listing.

Q: What shops are open to me to work on personal projects as an undergrad?

A: Hobby Shop, Edgerton, MITERS. 

It’s also an open secret that you can judiciously use your UROP shop access for personal projects; see later in this post for more info on UROP shops (the biggest ones are Media Lab’s and CSAIL’s). In addition, several dorms / some students have their own mini-machine shops.

  • Edgerton
    It’s right behind CSAIL. Entrance is to the right, under the external staircase.
    • Who it’s open to:
      • “The Edgerton Center Student Shop provides training in the use of machine tools, access to them, and guidance in project planning, to any current MIT student.”
    • Types of Projects: 
      • “Once you’ve completed the course, you’re free to use the shop whenever you want, whether it’s for a class project, a student group you’re working with, or your own fun idea” (src)
    • Safety: 
      • Either take the shop training class or test out of it and just take an hour-ish edgerton shop familiarization lecture
    • Hours: 
      • Open “business hours”, aka “9 to 5”-ish.
    • Cost: 
      • Free
    • Noteworthy Equipment: 
      • CNC mills and lathe
      • welding (mig, tig, stick)
    • Sometimes staffed by students
  • Hobby Shop
    Almost next door to the student center. Entrance 1: door under white box (right part of image)
    Entrance 2: door under white box (left part of image)
    • Who it’s open to:
      • “Membership to the Hobby Shop is open to MIT students, staff, faculty, retirees, alumni/ae, and their spouses”
      • “Today, the Hobby Shop provides a place for any MIT student, regardless of major or experience, to work with a wide range of well maintained machines and tools and to receive instruction, as well as practical design and building advice. 
      • “The Hobby Shop now offers its own classes” (mostly IAP ones around specific projects, I think)
    • Types of Projects:
      • “Projects can be academic or personal, serious or just for fun.” (src)
    • Safety:
      • Don’t really need machining experience (the instructors will help you when you have your project in mind), take the shop orientation and you’re set
    • Hours:
      • B
      • Business hours
    • Cost:
      • $30 / term (spring, summer, fall) or $75 / year
      • Noteworthy Equipment: 
        • More woodworking tools than anywhere else
        • CNC mill and lathe
        • Waterjet (membership + $2/minute)
        • Equipment List (with pictures even! very nicely done)
    • MITERS
      Same building complex as MIT Museum (across from Random / Shaw’s). Entrance 1: under white box (to left of yellow truck)
        Entrance 2: Under white box
      • Who it’s open to:
        • “We are a student group promoting making things for the fun it. We are MIT’s only student-run shop, and we do not receive funding from any MIT department.” (src)
        • Open to everyone, but especially MIT undergrads
      • Types of Projects:
        • “It’s a member-run creative haven and build-anything-you-want, if-you-break-it,-fix-it space.” (src)
        • Class projects, UROPs, and projects-just-for-fun all welcome, as long as you contribute back by keeping the shop clean and hanging out with us
      • Safety:
        • Edgerton shop training highly recommended
        • Only open when a keyholder (student who’s hung out a lot, i.e. know the quirks of MITERS’s equipment, and has taken Edgerton training) is there
      • Hours:
        • Whenever a keyholder is there, aka almost 24/7. Once you become a keyholder yourself, you can go whenever you want (though if you’re working w/ power tools, must have at least one other person with you).
          • When I took 6.131, lab closed at midnight and we’d all migrate to MITERS to pull an all-nighter
      • Cost:
        • Free (our budget comes from students like you volunteering on our behalf at Swapfest (src)
      • Noteworthy Equipment:
        • EE lab as well — components, power supplies, oscilloscopes, pcb etching
        • welding a possibility, email our list directly for more details
        • Manual lathe, numeric read-out (not CNC) mill
        • Equipment List (with pics)

    ~~~following WIP, to be fleshed out~~~
    Waterjet: media lab (24/7), CSAIL (24/7), architecture bldg10 4th floor (24/7 I think), 2.007, hobby shop … idk other shops (16?)

    • UROP or take classes @ media lab and sign up for their shop training right away (24/7 access)
    • UROP @ CSAIL and sign up for shop training right away (24/7 access)
    • course 4 major

    Lasercutter: media lab (24/7), CSAIL (24/7), architecture (24/7), 2.007?, commercial shop by 2 MIT alumni: danger!awesome right near Central T stop / Toscii’s, … idk other shops (16?)

    • urop / class @ media lab
    • urop @ csail
    • csail
    • be course 4 major
    Shopbot (giant CNC mill): media lab, possibly UROP w/ MIT Museum?
    Injection molding: yea right. take 2.008 and make friends with the shop guys?

    Vacuum forming: media lab (24/7), architecture (24/7), 2.008


    small CNC mill, milling / etching: roll your own for ~$200 with waterjet and scrap Al


    Stock: MIT central machine shop, McMaster-Carr, Turner Steel
    ee-ish: hobbyking, ebay, amazon surprisingly
    silicon molds / plastic / food-safesmooth-on
    through ECAT vendor for your UROP: digikey, mouser, jameco

    ~~~~~~
    Appendix, LMP

    The Manufacturing Lab in building 35 will be open for extended hours on Tuesday’s & Thursday’s from 5 – 8 PM for use as a trial period under the following criteria starting next Tuesday 2/28/12:

    • Students will need to meet with the technical instructor prior to starting any work and sign in & out on the evening sign in sheet.
    • There will be a maximum of 8 students allowed in the shop.
    • This time is for Mech E students only
    • Graduate Research and SB Thesis; UROP; and personal projects can be done during this time with priorities in that order.
    • No course work can be done during this time.
    • This time cannot be used for any non-MIT project, or for extramural consulting work.
    • Not all machinery will be available for use (IE: waterjet, injection molder, 5 axis mill).
    • Students are required to supply their own raw materials.
    • You can reserve a spot in advance by emailing bbuckley@mit.edu
    • Should you not show for a reserved spot you will not be able to reserve a spot in the future.
    • We will not be able to support and teams or clubs during this trial period but may be reviewed in the future.

    Mary Boyce, John Lienhard and Bill Buckley

    ~~~~~~
    Appendix, online resources
    no substitute for learning in person!
    http://www.machinistblog.com/mit-techtv-machine-shop-videos/
    http://electron.mit.edu/~gsteele/mirrors/www.nmis.org/EducationTraining/machineshop/outline.html
    ~~~~~~

    Conclusion

    X ALL THE THINGS - MACHINE ALL THE THINGS!
    ^___^

     

    analog oscilloscope tips and tricks

    yay 6.302 labs and analog oscilloscopes

    Lab 1A

    • 10-90 marks to the far left of the screen –> line signal up at 0-100 (use “var” [see Fig. 2] to resize voltage divs as needed), then use 10-90 marks + the cursors to measure 10-90% rise times
      Fig1. thanks Shane for unwittingly donating this image
    • function generator has “sync” output –> trigger off of that
    • “to give yourself some more time to make the measurements, you can increase the intensity of the beam so the persistence lasts longer. Also triggering off of the signal generator’s ‘sync’ line can help produce more regular triggering. The scopes generally trigger better on high frequency signals, so for those measurements that are not frequency dependent, using higher frequency input signals may produce results that are easier to handle.”
    Lab 1B
    Fig 2. thanks Lim Siong Boon for unwittingly donating this
    • if you have more than one output option selected, also select “chop” to show them simultaneously, otherwise scope will show one signal, then the other
    • to show “add”d result, turn off all the other buttons (it only adds ch1 and ch2, depressing those buttons does not help it)
    • no need to unplug the scope probe, simple switch output to “GND” to get where the ground line is (for zeroing)
    • Not a oscope tip, but 
      • wrt the amp: there are rail-to-rail amps and the other ones are almost rail-to-rail. the amp / rails limits how fast your system responds at high freqs
      • impulse = frequency response because in Laplace = 1, aka sweeps all the freqs
      • step is just frequency response settled to DC
      • voltage driven, response to input limited by back EMF; current-driven, not so
    List will be updated as term goes on