Introduction: Alfred

Alfred is your everyday personal assistant. He sit's on your table, on your lap or even watches you from any corner of your room.When something important occurs, he will speak to you.If you have any questions, he will answer you. So simple, you will never be alone again ;).

Target audience

Besides the standard version of Alfred that will be designed for grown up people, there will be a special version for younger kids. It will act like a Tamagotchi. Kids will need to pay attention to him, speak with him and will be able to learn about interesting things. Grown ups can see a life companion in Alfred.

Step 1: ​Technical Solution

Underneath Alfreds soft and cuddly skin, he has an edison pcb with led lights, touch sensors, a loudspeaker and a microphone.

The lights are used to indicate his mood. In the future servos can support the emotional expression.

Touch sensors enable the detection of strokes that will increase Alfreds mood.

Step 2: ​Project Takes Advantage Of

Cloud connectivity possibilities

  • Easy access to modern cloud api's.
  • Ability to directly alert the user in urgent cases (e.g. bitcoin stock drops very fast, weather is changing unexpected).
  • Access to twitter trending tags and news sites.
  • Control Smart Home devices (e.g. LIFX)
  • Other apps will be able to push data to Alfred via a public api.

Sensor possibilities

  • Wireless sensors inside and outside the house can check the
  • weather
  • room temperature
  • detect if you are at home/alive/sleeping
  • detect extraordinary behavior

Project makes use of:

Software components

  • Software will be developed using JavaScript/NodeJS using Intel XDK.
  • Usage of public NPM repository (https://www.npmjs.org) for cloud connected features (lifx, twitter).

Step 3: Prepare Your Maskot

  1. Choose a maskot
  2. Poke an LED through it's eyes
  3. Connect the LED with the Groove LED board on the backside
  4. Connect the Groove Board to your Edison

Add as many actors as you want (more LED's, servos for moving eyebrows, LCD for text output, touch sensor to detect strokes).

Step 4: Code

A lot of things can be directly programmed using the Intel XDK. Here are a few examples of what you can do:

First line (always needed):

var mraa = require('mraa'); //require mraa
console.log('MRAA Version: ' + mraa.getVersion()); //write the mraa version to the Intel XDK console

Write something to the LCD:

var LCD = require('jsupm_i2clcd');
var mylcd = new LCD.Jhd1313m1(6, 0x3E, 0x62); mylcd.setCursor(0,0); mylcd.write('Hello, I am'); mylcd.setCursor(1,0); mylcd.write('hungry');

Light up the eyes:

var leftEyeLED = new mraa.Gpio(1);    // Create LED objects
var rightEyeLED = new mraa.Gpio(2); leftEyeLED.dir(mraa.DIR_OUT); //set the gpio direction to output rightEyeLED.dir(mraa.DIR_OUT); leftEyeLED.write(1); rightEyeLED.write(1);


Control your LIFX Lights using a button/touch sensor and potentiometer:

Install lifx npm library:

# ssh root@your.eidson.ipaddress<br>
# cd /node_app_slot/<br># npm install lifx

Now you should have installed an additional node library you can import in your code:

var lifx = require('lifx');<br>var lx   = lifx.init();

Read the touch sensor and poti and switch your light-bulb:

var light_state = 0;
startSensorWatch(); function startSensorWatch() { 'use strict'; var touch_sensor_value = 0; var digital_pin_D2 = new mraa.Gpio(2); //Touch Sensor connected to D2 connector<br> digital_pin_D2.dir(mraa.DIR_IN); console.log('sensorwatchstarted'); setInterval(function () { touch_sensor_value = digital_pin_D2.read(); if (touch_sensor_value === 1 && light_state === 0) { console.log("Lights ON!!!"); lx.lightsOn(); light_state = 1; while (digital_pin_D2.read()); } else if (touch_sensor_value === 1 && light_state === 1) { console.log("Lights OFF!!!"); lx.lightsOff(); light_state = 0; while (digital_pin_D2.read()); } }, 200); // Call this function every 200ms } var potiPin = new mraa.Aio(1); //setup access analog input Analog pin #1 setBrightness(); //call the periodicActivity function var brightVal = -1; function setBrightness() { if (brightVal != potiPin.read()) { //read the value of the analog pin brightVal = potiPin.read(); lx.lightsColour(0xd49e, 0x0000, brightVal*64, 0x0dcf, 0x0100); } setTimeout(setBrightness,50); //call the function after 50ms }

Step 5: Further Things to Do

I'm actually trying to get an audio input and ouput running on the Edison. Until now I wasn't able to do this (USB cards don't work and maybe I need to wait for official Quark support and program my own card). If you have any Idea how to do this easier, please write in the comments.

Comments

author
seamster made it!(author)2014-12-12

Nicely done!

About This Instructable

549views

3favorites

License:

More by SandraBemyapp:Alfred
Add instructable to: