Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.
Showing posts with label arduino. Show all posts
Showing posts with label arduino. Show all posts

2016/10/15

Gender and Wearables?


First I heard about modern wearables was at Indiana Linuxfest, where the speaker went on about the coming wave of microcontrollers and posited a belt buckle that was aware of when it was pointing toward magnetic north and activate a haptic feedback device, so that, for the wearer, eventually true sense of direction would eventually become another sense.

I'm sure I could find a sensor that could tell me that, that could ship from China and cost me less than a gumball. I'm sure I could easily get a buzzer, that I could control it all with a small Arduino board like a Trinket or Flora or Nano or the like. and Jimmy DiResta has already taught me how to make a belt buckle. And I actually kinda want one. But I haven't made it.

In part it's because my available resources to push toward projects like this are small at the moment. In part, though, it's because, once I put on my watch, my tablet, my glasses and the Leatherman on my belt, I'm accessorized out.

I think most American men are about the same. 

2015/08/01

What Language Should I Learn? Three Answers

A friend of mine, who works in IT but is not a developer, asked me a question during lunch today.

"I want to learn to program. What language should I learn first?"

This is a common question, one I have answered before. But, because I've blogged a lot recently, I've decided to write it up and post here.

I told him I have three answers.

The first is somewhat sarcastic. "I'm going to Europe. What language should I learn?" There just is not enough information to really answer that question, because many languages are very context-specific. If you're hoping to get into programming apps for the iPhone, your best choice is Objective C. If you want to code for Arduino microcontrollers, you'll want to start with the Arduino IDE and it's very C-like language. And, of course, there's JavaScript, your only choice on web browsers.

Where you want to go determines what you should learn.

But there's more to it than that.

There's a thing called the Church-Turing Theory, which states that any real-world calculation can be computed. Turing postulated using a Turing Machine, while Church referenced the Lambda calculus.

We get to a concept called Turing Completeness. A thing that can be computed in one Turing-Complete machine can be simulated in another Turing-Complete machine. The first real use of this was the creation of compilers, of higher-level languages that developers can use which compile to machine code that the hardware itself can run. What it means, for those learning, is that it doesn't really matter what language you learn, that anything one language does can be done by another language.

So the second answer is, Alan Turing would tell you it just doesn't matter which language you choose, that what you do and learn in one language can be simulated or applied in another language. So it doesn't really matter which you choose.

When Jeff Atwood of Coding Horror coined Atwood's Law -- any application that can be written in JavaScript, will eventually be written in JavaScript -- he didn't know the half of it. He knew that graphical applications were starting to be done within web browsers, like Gmail, He didn't know that web server applications and even command-line applications could be written in JavaScript via Node.js. He didn't know that a framework for creating cross-platform mobile applications using web technologies including JavaScript called Cordova would come along. He didn't know that Microsoft would allow developers to create Windows applications using HTML and JavaScript. He didn't know that Open Source microcontrollers such as Arduino would be developed, and frameworks such as Johnny Five would come to allow you to develop Internet of Things projects and even robots with Javascript. It might be a bit more complex to set it up to do these things with JavaScript, but they are possible.

Plus, if your code plans are more functional and computer-theoretical, you'd be glad to know that JavaScript is a Lisp.

If you want to code Objective-C, you need a Mac and the Apple development tools. If you want to code C#, you'll need to install Visual Studio tools from Microsoft (or Mono on Linux). If you want to code JavaScript, you'll need a text editor (and one comes with your computer, I promise) and a web browser (and one comes with your computer, I promise), plus there are places like CodeBin where you can enter your code into the browser itself .

If you're going to be writing an operating system, device drivers, you will want something that compiles to native machine code. If you're looking to get into a specific project, you'll want to know the language of that project. But the corners of the development landscape where JavaScript is the wrong choice are small and shrinking. So, the third answer is, it might as well be JavaScript.

This rubs me a bit wrong. I've set my rep as a Perl Monger, and I always feel like that's where you should start. But while my heart feels that, my mind argues the above, that the greater forces of modern computing are pushing to give JavaScript a front-row seat in the language arena.

But I'm willing to be wrong, and if I am, I want to know. Where am I wrong? What would you tell someone wanting to learn to program?

2015/04/15

We Have The Facts And We're Voting Arduino.cc

You've seen my posts on Arduino before. It's a microcontroller, released with an Open Source license, that finally allowed me to transition from programming bits to programming atoms. OK, I need to gear up and get a servomotor or something, but the point remains.

For years, the place to go for Arduino downloads and documentation was arduino.cc. Things are now changing...

Arduino LLC is the company founded by [Massimo Banzi], [David Cuartielles], [David Mellis], [Tom Igoe] and [Gianluca Martino] in 2009 and is the owner of the Arduino trademark and gave us the designs, software, and community support that’s gotten the Arduino where it is. The boards were manufactured by a spinoff company, Smart Projects Srl, founded by the same [Gianluca Martino]. So far, so good.
Things got ugly in November when [Martino] and new CEO [Federico Musto] renamed Smart Projects to Arduino Srl and registered arduino.org (which is arguably a better domain name than the old arduino.cc). Whether or not this is a trademark infringement is waiting to be heard in the Massachusetts District Court.
According to this Italian Wired article, the cause of the split is that [Banzi] and the other three wanted to internationalize the brand and license production to other firms freely, while [Martino] and [Musto] at the company formerly known as Smart Projects want to list on the stock market and keep all production strictly in the Italian factory.
(quoted from Hackaday)

I'll repeat a line. Whether or not this is a trademark infringement is waiting to be heard in the Massachusetts District Court. It is a matter of law, not up to me. As the boards are Open Source, you are well within your rights to make your own, as we at Lafayettech Labs have considered. (We decided that the availability of inexpensive small boards at SparkFun and AdaFruit make our board redundant.) I have a few boards from non-arduino.cc origins, but I have and am glad to have some that are arduino.cc boards, supporting the project that's inspired me. (And I'm reasonably sure that those boards were actually manufactured by Smart Products Srl).

You are also within your rights to fork a project and make changes, which is how Arduino code got ported to TI boards with Energia, and which is what Arduino.org did.

Using the same name.

GitHub user probonopd reported an issue with the Arduino fork:
Rename this fork and use less confusing versioning
This fork of the Arduino IDE should be renamed something else to avoid confusion, and a version number should be chosen that does not suggest that this fork is "ahead of" the original Arduino IDE when in fact it is not. Naming open source projects should follow community best practices.
As for "arduino-org", one can read on https://github.com/arduino-org that "This organization has no public members. You must be a member to see who's a part of this organization". This is quite telling. The real Arduino team is at https://github.com/orgs/arduino/people as everyone can clearly see.
There is a difference between trying to fork a project and trying to hijack a project, and I think this is clearly what Arduino.org is trying to do. I urge everyone interested in Open Source to urge them to rename and re-version their fork, by making this issue known among their community and by firmly but politely agreeing with probonopd and his, like the over-300 users who already have.

Rename the fork!

2015/03/04

BLE, in case you care


These nRF8001 Bluetooth Low Energy boards are from Adafruit, When I got them, a friend soldered on the header pins, and one didn't work. I started a long conversation with Adafruit — it's not conductive to debugging when you can only do it one evening every two weeks — but I finally got pictures into them, and they suggested resoldering the ground pins. The friend resoldered them and other pins, and now, I believe they're both going. 

Of course, I need to get some more code to write and some more bits to pump before I definitively say "Yeah", but it looks like I'll soon be able to move on to learning to write things that talk to them. 

On Android. In Java.

Or on Windows. 

Looking forward to that.

2015/02/23

Bug Report? Rant? Request for help? Running Bluetooth Low Energy from Arduino

I'm with a group working on a thing. What that thing will do is not important to this discussion at the moment. What is important is that I'm expecting a flood of data from the thing (think QS/IoT) to a phone. Plus, I'll have a second thing, doing the same thing.

The current demo hardware is using wireless ethernet, which is proving slightly problematic. It's built with the idea of being used by hobbyists who want to put the chip in a thing, not for a group of many developers to prototype and develop on the hardware. I'm also unsure about the ease of setting up WiFi Direct on two devices with simplified user interfaces, and whether it'll block your phone.

So, I'm looking into Bluetooth Low Energy. I got two BLE breakout boards from Adafruit, had a friend solder in the header pins, and hooked everything up according to the docset with my Arduino Uno R2. I installed the Nordic UART app on my phone and got bi-directional communication going from my phone to my laptop and vice versa.

Then, I tried to wire up my $9 Arduino, a Leonardo clone. No go. (I did it wrong. More later.)

Then, I bought an Arduino Uno R3 at half-price from Radio Shack. No go.

Then, I borrowed an Arduino Mega and started to look into the pins. By the code, the pins not set in software are the ones providing the breakout board with CLK, MISO and MOSI. This is my first time talking to a breakout board, so I'm a neophyte to the ways of SPI. The Leonardo moved the SPI controls to another set of pins, so now that I'm slightly less dumb, I get why that failed. But the fact that the Mega and Uno R3 failed still confuses me. I timed out at midnight — had more things to do the next day than time — so I don't know if I'm stupid or what, but I had others verify I had the wiring right, and I think I plugged the second board into the first breadboard, just to ensure both were working.

I think.

Ultimately, getting this working with my R3 (or whatever) is a means to an end. It gives me behavior similar to what I expect from the things, so I can begin to work on the part that's receiving. I want to listen to two BLE devices at once. Or four. Or five. Or more. These things will be our things, perhaps coded in Arduino or not, but will certainly not be Leonardo or Uno boards, so understanding how SPI works differently on these boards is ultimately useless.

Except it absolutely must happen to move on to the next step.

Contributing to this frustration is the fact that I don't know enough about the problem domain to ask an intelligent question. I'm coming into the world of Arduino as a programmer, and in essence, what I have are variables I can set high or low, or sometimes somewhere in between, and variables I can check that are high or low, or sometimes somewhere in between. Between the set and ground, or 5V and checking is a circuit, and there's a lot about wires and resistors and the process of handing variables around that I just do not understand. With the Leonardo, the step after next (after being sure the second board works) would be to find female-to-female jumper wires, as all I have are male-to-male, then wiring to those SPI pins should be cake.

But it strikes me that someone else has failed to get this working on R3 Unos before, and I'm not seeing that person's cries for help, maybe because I'm not looking in the right place. Neither Stack Overflow nor the EE Stack Exchange site seem to really be good places, and as useful as the Adafruit Learn page is (written by the man who wrote the book on BLE), there's no way to engage back, to get clarification.

Anyway, I'll beat some more on it this evening. We'll see how far I get.

2012/10/31

What to do with this?

It's pretty simple. There's a magnet and a sensor. If the magnet is away from a sensor, it trips the circuit, turning on the LED. There's three button batteries up in there to light the LED with 3.5 volts or so. All that for a buck from the discount store.

So, let's think.

You can get the 3.5 volt current from the power pin of an Arduino, and sending the signal back to the Arduino rather than to an LED, you now get an "Is it closed?" sensor.

So what? What can we do with that?

I don't really care about what happens with the drawers in my office and I really don't care what happens with the drawers in my bedroom. Same, pretty much, with the doors. I never close my closet door, and really, hooking something to the bathroom door has nothing but creepy uses.

So, what can I do with this? I'm failing at ideas.

2012/08/21

Easy Does It!

As previously blogged, my Stapes Easy button has been turned into a switch and connected to a Teensy. The last issue was getting the code worked out. I now have that code worked out.

And released to Github.

// ========= ========= ========= =========
void setup() {
  // make pin 10 an input and turn on the 
  // pullup resistor so it goes high unless
  // connected to ground:
  pinMode(10, INPUT_PULLUP);
  delay(2000);
  Keyboard.begin() ;
  }

// ========= ========= ========= =========
void loop() {
  if ( digitalRead( 10 ) == LOW ) {
    Keyboard.press( KEY_SCROLL_LOCK ) ;
    Keyboard.releaseAll() ;
    delay(300); 
    Keyboard.press( KEY_SCROLL_LOCK ) ;
    Keyboard.releaseAll() ;
    delay(600); // Delay of 6/10 second to keep from repeating.
    } 
  delay(10);
  }

This was my first serious use of Github for Windows, too. Far easier to handle than the previous stuff I did.

2012/08/20

Easy Like Sunday Morning

Remember my intention to reimplement the Button?

I have my Easy Button torn down, with the speaker out and the circuit bent. You press the button and there is definitely signal going through. I scratched away at the green and soldered in. It works.

On the other side, I have my Teensy, and man, is it teensy. I'm now 93% sure that the micro-B USB cable I've been carrying arround is charge-only, because I couldn't get it to update the code. The code it has on it right now simply kicks out "Hello World" every 5 seconds. The next step, obviously, is to get the Teensy and the easy together, to code it up so that when I hit the button, it kicks out two scroll-lock characters, and to put that code up on Github.

And, to get a nice long micro-B cable.

2012/07/09

Planning My Lamp Project, with Pictures


Have I gone on about my lighting plan? No?

It connects a few of my interests and plans.

  1. I'm starting to become a morning person, which gets a bit hard during the winter, when sunrise is several hours away when I get up. Darkness is important for serotonin is important for sleep, but lightness is important for waking up. But sunlight alarm clocks are both expensive and a single-tasker in my mind. Multitasking might be bad for people's heads, but to my mind (and Alton Brown's) our tools should be multitaskers. 
  2. The Android@Home talk at Google I/O 2011 really inspires me, too.
  3. The key to the sunlight lamp is the fade of it. It strikes me that jarring changes from dark to light would not be as good for waking up well as a gentle increase of light. Like sunrise. 
  4. I'm learning about the Arduino and electronics in general and want to develop those skills more. I'm also a programmer, so these things I build, I'd ultimately want to be able to control via web interface and/or crontab.
  5. I like torchiere lamps, the kind that bounce light off the ceiling, but the one I still have is a halogen lamp, and the problem with halogen lamps is that they get crazy crazy hot, and my current one is either broken or has a burned-out bulb. I'd rather replace it.
  6. The means I know so far to control the dimming of lights is phase width multiplexing, which means turning on the LED for a number of milliseconds and then turning it off for another number of milliseconds to make it seem like it's dim, but you know? There exists an entire industry which involves itself with creating of light from electricity, and I'd rather work with that and involve the greatest amount of industry standard and the smallest possible amount of individual invention.
So, I went searching in Menards on Sunday, and I found a few things. There's a torchiere lamp that's $21 and a wall switch that'll dim CF bulbs for $17. (I'm going to have to live with a lamp with a hacked wall switch on it. I'll live.) The CF is $7, but it'll pay for itself over time. The one-gang outlet box will be < $1. Somehow, I'll have to mount it, but I can dream about that later. I'll need to get two switches, I think. One to make work and one to tear down and connect the Arduino to. That makes it $21 + $17 + $17 + 7, which brings us to ~$60. Before the cost of an Arduino. And I'll have to get a shield

Thing is, I get something like this $7 switch and I won't get the graceful increase or the control, but I get something I know works. Maybe I should think this through some.

2011/09/25

How Can My Computer Know I'm At My Desk?

The problem is exactly as stated. I have my computer do certain alerting things, but unless I'm physically near, I don't it to do some of  'em. And it would be nice to be able to use it to enable certain security aspects, less "unlock when I show up" but rather "lock when I leave". But first, of course, we must have that mechanism.

So what are our choices?

  • Motion Sensor - I like it. I used to have one in my den to control the light. It's neat. For work areas, I strongly suggest them for your lights, and have on this blog in the past. But you don't always have motion, especially when you've messed up line-of-sight or have a moment of stillness. So, it's a factor, but not the factor.
  • Light Sensor - That won't tell me everything, but will tell us something, and that something is that the light switch is on at my desk. Not perfect, because often my coworkers turn the light on when I'm not yet there, but it's certainly better than nothing. 
  • Location Sensing - My phone is the very definition of an Every Day Carry, and being a GPS-enabled Android which talks to Latitude, I can query Google to find out where I am. Except, where I am at work is in a subbasement, with no radio and no cellphone, so the location sensing defaults to a switch on the other side of campus, which hardly works. Maybe I should try it for "at home". 
  • WiFi - If my phone is connected to my home network, my switch knows it and with a little coding, I can use it. Which is great, but when I'm at home, I often have WiFi off, and sometimes I use 4G (in the one corner of town where Sprint has 4G). Sometimes I don't though, which makes it a poor indicator at home. But it gets worse at work. My desktop is behind a firewall and my phone would be on the campus WiFi, so never the twain shall meet. I could write something that announces every 10 min or so that I'm on the campus network, should I ever get far enough into coding Android, but it isn't there yet.
  • Bluetooth - This is the one I'm currently dreaming about. My dongle is Class 2, which means I have about 30 feet of range (and possibly less at the office). That's a nice range.
Without the addition of hardware I don't yet own, I'm thinking that the best solution is Bluetooth. I think that I could have fun making a dingus with Arduino that does motion sensing and light sensing (and maybe a thermometer) so I can get all sorts of data I can play with, but I can't play with that at work tomorrow.

Any thoughts I'm missing besides USB dongle and smart card you can think of?

2011/02/02

The Internet of Things? The Semantic Web?

I have a dream.

I dream of a lamp. A lamp using LEDs. A lamp that changes color, depending on the ambient temperature outdoors. If the weather outside is frightful, the lamp indoors is blue-to-purple. If Summer's here and the time is right, the light is yellow, orange or even red.

This dream is in part inspired by my workplace in the subbasement of my building. I can very easily forget the season, even, when I'm head-down into my work, so any reminder of the conditions outisde would be good.

This is an example of what was called Ubiquitous Computing or Pervasive Computing, depending on who generated the buzzword. In essence, the data is everywhere around you, not just on your PC.

The thing that's really keeping me from realizing this dream is a lack of electronics skill.

But that's a smaller thing today.

There's a thing called an Arduino, which is an Open Source bit of hardware that begins to open up the world of programming small things. I'm fairly sure I could, given an Arduino and a breadboard, begin to dummy this up.

This kinda gets me to categorization issues. Does this concept, an internet-aware fixture that determines the shade by the weather report fall under the Semantic Web? Or is it more tightly connected to the Internet of Things concept? Or is it a bit of both, like a Reese's cup?