Skip navigation
2015

Today was the arrival of the Arduino Yun, thank you very much to all our sponsors.

 

So Chrystal and I have been busy cutting out a clock and programming the Arduino and LED cape. In order for the clock to keep time we are going to have a sensor detect the minute hand gear for correct 1 hour per revolution. If the hands are out more then 2 minutes it will be corrected by the arduino connected to the servo. We also connected 3 ultrasound sensors to check for movement in the room. If the distance to the couch without anyone on it (say 12 ft) is sensing a distance of 10 ft 8 in, the arduino will consider that it is occupied. if that distance doesn't change more then 1" in 10 minutes it will figure the occupant is sleeping and turn down the lights. We also are using one to check the height of the person standing in front of the clock and call them by name. Chrystal thought this would be an enchantin idea to add. There is a lot more to update with photos which will come tomorrow.

 

A quick question to everyone, is the SAMA5D4 xplained not very well explained? I can't find anything that isn't a demo. I have been going crazy to come up with a useable OS for it, I am even trying to create my own, but time is the problem. Is there any non-demo OS available? Hacking the files got nowhere, I do require direction with this. I am not new to development boards, but this is got me baffelled. I have created a Beowulf cluster from RPi's, changed the RPi to run the gpio's from Scratch language for my kids. Any advice on non-demo software?

 

Thank you all,

Chrystal and Dale Winhold

crjeder

Smart Key Hooks – The Design

Posted by crjeder Mar 30, 2015

Let's recapitulate: My Enchanted object consists of a sheet of brushed stainless steel with 5 hooks to hang keys. Magnets are used to stick notes to the board. In this blog post I will (try to) design the application as good as possible. Hopefully this can serve as a framework for my (and others) future projects.

 

User Interface

I'd like to keep the user interface as clean and natural as possible. No additional buttons and no restrictions should be added. The users should be allowed to hang their key on any hook they like and use any free magnet to post messages. The online interface consists of a simple command and return value. Here is a table with the actions a user can do an the effect of that action:

 

User Action

Effect

Remove key

Change status of the respective person to „out“

Hang key

Change status of the respective person to „in“

Request status of person <name>

Return status of person <name>

Remove note

Send „Note removed“ message

Add note

Send „Note added“ message

Update my status LED <colour>

Set the colour of the status LED of the respective person to <colour>

Request full statusController sends all (user permitted) status information
Power resumedSend Power resumed message

 

Use Cases

The information provided by the Key Hook Controller (SAMA5D4) alone is of not much use. But combined with other smart home information it can be very useful:

  • If nobody is at home turn off the central heating
  • If a person signals that it will arrive soon turn it on again
  • If the shed key is returned but the shed is not locked send a message
  • If the children have not left until 7:00 send an alarm (they will be late for school)
  • If a note is removed cross off something of the To-Do list

 

Normally a smart home controller will be able to take actions like the above. Since my home is not „smart“ I will simulate it with a cloud messaging service and an android app called tasker. This app works like IFTTT – it accepts messages and takes actions. I'll use the SAMA5D4 Xplained Ultra as the controller.

Sensible Data which is Processed

The data we are dealing with is quite personal as it shows a lot about the habits and relation of the people living in the house. The data can be abused in many ways. Most obvious is the use for burglars – they could learn when nobody is at home in order to break in to the house. But with the technology available today much more can be learnt from it. And this data is valuable for corporations and governments alike.

First step into security is to enumerate the data we are dealing with:

From Devices connected to the smart key hooks:

  • user identities
  • connection information
  • passwords
  • meta information (date, time, IP address, coarse location, …)

From the smart key hooks:

  • Presence Status
  • Notes

Now we have established that we need to protect the data from peeping eyes, we'll have a look at how the data is attacked and how we can protect them.

Data flows

The following chapter is a very simple implementation of the Application Threat Modelling from The Open Web Application Security Project (https://www.owasp.org/index.php/Application_Threat_Modeling).

data flow.png

Data is generated by the sensors connected to the controller and sent from the clients over the Internet. The Trust boundary is clearly the Internet connection of the controller.

 

Threat Modelling

Threat Modelling tries to describe all relevant attacks on the system. It tries to answer the question where and how your data is endangered by the system / application. Here I will use STRIDE to guide me through the process.

This may seem trivial and for a relatively simple application like this it really is, but it will help to make the right decisions later.

From wikipedia:

STRIDE is a system developed by Microsoft for thinking about computer security threats. It provides a mnemonic for security threats in six categories.

 

The threat categories are:

  •     Spoofing of user identity
  •     Tampering
  •     Repudiation
  •     Information disclosure (privacy breach or data leak)
  •     Denial of service (D.o.S)
  •     Elevation of privilege

So let's jump right into it.

Spoofing of user identity

Users are represented by their key fob which is attached to the key ring. Since users can easily change key fobs / rings technical measures against identity spoofing are not effective. More security would be needed (e. g. PINs / passwords) if rights are attached to key ring identities. On the other hand there is an inherit antipathy of sharing keys even within a family which should be effective against identity spoofing.

Tampering

The program and data is stored in the controller’s flash and RAM which per se is not secure against tampering. Among the security features of the SAMA5D4 is a integrity monitor and a SHA engine. Those can be used to make sure that the content is not changed or to at least to detect changes. Tampering can happen over the network or directly on the hardware by using e. g. the USB ports or removing the flash card. The later is covered by physical security.

Any networked computer is susceptible to “hacking” which can lead to data being changed. To reduce the attack surface the smart key hooks controller does not host any network services. It communicates only with the cloud service to send and receive data.

Malicious clients might send crafted data to corrupt data. Therefore data orginating outside of the trust boundary has to be validated.

Repudiation

The following definition from Wikipedia for Non-Repudiation is relevant to our scenario:

A service that provides proof of the integrity and origin of data

So the threat of Repudiation is to claim that the data is not authentic or is from a different source than claimed. Countermeasures usually require a PKI which is out of scope of this project.

Information disclosure (privacy breach or data leak)

Because of the private nature of the data this the treat which comes into mind first. Of course we do not want our data to be disclosed to any unauthorized party. Not when stored neither when transmitted. End to End Encryption is effective against this attack. One challenge of using encryption is key handling. In this application the user base is small enough to use pre-shared keys without to much disadvantages.

Denial of service (D.o.S)

D.o.S. would be relevant only if we were doing business or some more vital parameters of the house being monitored (like water leakages e. t. c.). Therefore we don't care about this threat here.

Elevation of privilege

Since in a good design all processes have minimal privileges and services delivering information (e. g. web servers) to the untrusted world usually run on least privileges, it's a top priority for a successful attacker to gain additional rights. To protect against this is a difficult task since we will have procedures which need root rights to access the hardware. So I'd try to not let any user data be passed on to procedures with high privileges.

Physical Security

Key hook is inside the house which is trusted for physical security. So no authentication is necessary for interface interaction. The controller board needs to be secured against unauthorized software install. Secure boot and tamper protection can be used for this. Documentation for both features is under NDA so they cant be used in this project. If I can find an other way I'll implement some tamper protection.

Many thanks everyone

2015-03-30 10.56.23.jpg

The Woodcutter

 

Matilda needed some wood for the house extension so she set off through the forest to visit the woodcutter. She found him in a clearing formed by trees that had fallen in the same storm that had damaged the enchanted cottage. "Several trees fell during the storm" said the woodcutter, "but I did not hear them". The wood cutter pointed to the young sapling amongst the fallen trees. "The sapling bends with the wind but the oak breaks" he said. Matilda thought maybe the woodcutter spent a bit too much time on his own.

 

Matilda showed the wood cutter her plans for the basement and rear extension to the enchanted cottage.

Plans.jpg

The woodcutter set about one of the fallen trees and soon had it converted into planks for Matilda's design, she helped him load the into the cart and then headed off to see the blacksmith

Planks.jpg

The Blacksmith

Matilda always liked visiting the Cel the blacksmith as it was always nice and warm in his shop. She showed Cel the plans for the Watt's linkage and the he set about making the first parts.

Rivets.jpg

When the tested them the pins were too weak and one snapped off. They both cursed at the wasted time and discussed an alternative. Their second attempt was successful and used a hardened screw to re-enforce the joint.

ScrewedParts.jpgScrewedJoint.jpg

Matilda redesign all of the parts to work this way and left the plans with the Blacksmith who set about making them.

BeamWithPins.pngBlacksmithsShop.jpg

There were a few changes to the parts over the next few hours but eventually Matilda has a set of components she was happy with.

LinkageComponents.jpg

By the time she had returned home, Hans had finished the repairs to the roof

 

{gallery:width=300,height=400}Roof repairs

RoofGlueUp.jpg

Roof Glue up

RoofBattens.jpg

Roof battens

RoofFinished.jpg

Roof back on

The next job for Matilda was to put the parts into motion and her thoughts thoughts returned to the words of the woodcutter. Perhaps she thought, rather than directly connecting the servo to her mechanism she could use a springy sapling. Then if anything locked up the sapling would flex rather than causing the servo or mechanism to break.

 

Next Enchanted Objects Design Challenge - Back on the straight and narrow

One of the most challenging part of this project is to measure the heart beat (and then blood pressure)

Hear beat measuring is based on the principle of photoplethysmography (PPG) which is a non-invasive method of measuring the variation in blood volume in tissues using a light source and a detector. Since the change in blood volume is synchronous to the heart beat, this technique can be used to calculate the heart rate. Transmittance and reflectance are two basic types of photoplethysmography. For the transmittance PPG, a light source is emitted in to the tissue and a light detector is placed in the opposite side of the tissue to measure the resultant light. Because of the limited penetration depth of the light through organ tissue, the transmittance PPG is applicable to a restricted body part, such as the finger or the ear lobe. However, in the reflectance PPG, the light source and the light detector are both placed on the same side of a body part. The light is emitted into the tissue and the reflected light is measured by the detector. As the light doesn’t have to penetrate the body, the reflectance PPG can be applied to any parts of human body. In either case, the detected light reflected from or transmitted through the body part will fluctuate according to the pulsatile blood flow caused by the beating of the heart.

The following picture shows a basic reflectance PPG probe to extract the pulse signal from the fingertip. A subject’s finger is illuminated by an infrared light-emitting diode. More or less light is absorbed, depending on the tissue blood volume. Consequently, the reflected light intensity varies with the pulsing of the blood with heart beat. A plot for this variation against time is referred to be a photoplethysmographic or PPG signal.

 

04 - PPG.jpg


The PPG signal has two components, frequently referred to as AC and DC. The AC component is mainly caused by pulsatile changes in arterial blood volume, which is synchronous with the heart beat. So, the AC component can be used as a source of heart rate information. This AC component is superimposed onto a large DC component that relates to the tissues and to the average blood volume. The DC component must be removed to measure the AC waveform with a high signal-to-noise ratio. Since the useful AC signal is only a very small portion of the whole signal, an effective amplification circuit is also required to extract desired information from it.


A very useful source of information was this one, where I got most of the information I need to build a heart rate sensor.


However, I decided to make some changes to the original design to use a different light sensor: the TCRT1000. This is a reflective optical sensor with both the infrared light emitter and phototransistor placed side by side and are enclosed inside a leaded package so that there is minimum effect of surrounding visible light. The circuit diagram below shows the external biasing circuit for the TCRT1000 sensor.

 

04 - TCRT1000.png

 

A fingertip placed over the sensor will act as a reflector of the incident light. The amount of light reflected back from the fingertip is monitored by the phototransistor.

The output (VSENSOR) from the sensor is a periodic physiological waveform attributed to small variations in the reflected IR light which is caused by the pulsatile tissue blood volume inside the finger. The waveform is, therefore, synchronous with the heart beat. The following circuit diagram describes the first stage of the signal conditioning which will suppress the large DC component and boost the weak pulsatile AC component, which carries the required information.

 

04 - Scope.jpg

 

The starting point for my experiments will be an adaptation of the original schematic of the Pulse Sensor module

 

04 - Schematic3.png

 

The basic idea is that the operational amplifier sums up Vcc/2 with the amplified DC component of the Vsensor

Vcc/2 is obtained through the R4/R5 partitor. The AC component is measured on the C5 capacitor. This signal is amplified by a factor of 330 (R1/R2). The RF1 trimmer will make it possible to fine-tune the gain

20150329.jpg

 

The first chapter is finished.
I started with a defect turntable. It looked good at the start but didn't turn.

It hasn't changed on the outside, but the inside is revamped with latest technology. And it spins!

 

Photo 05-02-15 22 23 55.jpg

 

In each of the previous 6 posts I have touched one isolated part of the table.

I covered the motor drive part, the speed detection part, and the firmware for each of these modules.

In this closure post we'll bring the things together and build the firmware that controls the table and keeps it up to speed.

 

The Firmware

 

The Arduino UNO that's one of the parts for the challenge has the control duty. The motor control and sensor capture blocks were already written for  the UNO.

In the final firmware design, they appear as the two top blocks. That shouldn't be a surprise, because they are the main touchpoints with the table's mechanics.

And it's those mechanics that we want to control.

design.jpg

 

The Feedback And Control Block

 

To make this design do something real, we'll have to tie the two blocks together.

We need feedback from the speed sensor to know how we have to adjust the motor.

We tell the speed control how fast our motor should spin.

The control block has the single duty to learn from the sensor block how fast the actual speed is, and adjust that speed via the motor drive block if necessary.

The control block does that in a neternal control loop.

 

Desired speed, hysteresis, loop frequency

 

There are three attributes and parameters that define the behavior of the control block.

  • desired speed: we tell the controller what speed it should aim for. This is the only attribute we control from the outside. The controller does all the management to achieve that goal autonomously.
  • loop frequency: this parameter tells the controller how often it should validate speed and adjust if needed.
  • hysteresis: this parameter tells the controller how much play area it has. We define the upper and lower acceptable deviations from the ideal speed.

 

The two parameters define how smooth the controller can handle its job to guard the speed. Playing with the table and listening to it is key while fine-tuning them.

To help with the parameterisation, I added a 3-LED display that shows the controller status:

  • SLOW: the table is spinning below its lower limit and the controller is speeding it up
  • OK: we're operating within bounds. The controller keeps the motor pace.
  • FAST: we're going too fast. The controller is slowing down the motor.

 

In the video below (8 seconds) you see this in operation.

I have tuned the control parameters bad on purpose for this video - and turned down the DC supply close to the lowest limit - so that you see something happening.

In well-tuned mode, the green led is on virtually all the time. A well tuned loop is boring to look at. There are more things happening when the device is outside its comfort zone.

 

 

Supporting Modules

 

There are two modules to support the turntable drive mechanism:

 

A user interface, where you can adapt the behavior and ask statistics. This simple serial monitor based front end has only three functions.

  • You can set the desired speed. When you enter a speed, the info is sent to the controller. From now on, the table will aim to stay on that new speed until it is power cycled (you could call this a calibration).
  • You can store the current speed in EEPROM. Once you've set the correct speed and the table is stable, you can tell it to save this setting. This is persistent. When you power up the table the next time, it will read back your stored setting at start-up.
  • There is a status function. The firmware tells the status of the three main blocks: the desired speed of the control block, the measured speed of the sensor, and the current PWM duty cycle of the motor drive block.

 

The second utility module is the persistence interface. It communicates with the ATMega EEPROM. It stores and reads the desired speed value. Without this tiny block you would have to set the desired speed each time.

 

The Code

 

Because this is the end of a chapter, and a whole functional block is finished, I'm publishing the full firmware code.

It isn't hard to recognize the blocks and methods from the architectural drawing at the start of this article.

 

 

 

/*


element14 enchanted objects
enchanted player
turntable speed control
motor pwm steering
motor speed counting


Includes most of the standard example ReadASCIIString
created 13 Apr 2012
by Tom Igoe


Includes Timer1 library
http://playground.arduino.cc/code/timer1


Includes avdweb Frequency / period counter for the Arduino
http://www.avdweb.nl/arduino/hardware-interfacing/frequency-period-counter.html


*/




// includes for PWM
#include <TimerOne.h>


// includes for sensor
#include <FreqPeriodCounter.h>


// includes for eeprom
#include <EEPROM.h>

// constants for PWM
const int iPwmPin = 9; // PWM only pin 9 or 10
const int iPwmEnablePin = 11; // motor on/off
int iPwmDuty = 400; // 705; // exact turntable speed at 10 volt


// variables and constant for sensor
const byte iSensorPin = 3;
const byte iSensoCounterInterrupt = 1; // = pin 3
FreqPeriodCounter sensorCounter(iSensorPin, micros);


// variables and constants for speed adjust
#define HYSTERESIS 10
int iPeriod = 0;
#define LED_SLOW 5
#define LED_OK 6
#define LED_FAST 7


// variableds and constants for EEPROM
#define EEPROM_DUTY_ADDR 0




// function declarations PWM
void pwmSetup();
void pwmChangeDuty(int duty);
// function declarations sensor
void sensoCounterISR();
void sensorSetup();
long  sensorPeriod();
// functions for speed adjust
void speedSetup();
void speedUp();
void speedDown();
void speedAdjust(int period);
// function declarations eeprom
void eepromWritePeriod(int period);
int eepromReadPeriod();


// ========== PWM code begin ==========


void pwmSetup() {
  pinMode(iPwmPin, OUTPUT);
  pinMode(iPwmEnablePin, OUTPUT);
  Timer1.initialize();
  Timer1.pwm(iPwmPin, iPwmDuty, 30); // duty cycle [10 bit], period [us] <8388480
  digitalWrite(iPwmEnablePin, HIGH); // enable OUT1
}


void pwmChangeDuty(int duty) {
  Timer1.setPwmDuty(iPwmPin, duty);
  iPwmDuty = duty;
}


// ========== PWM code end ==========




// ========== sensor code begin ==========
void sensoCounterISR() {
  sensorCounter.poll();
}


void sensorSetup() {
  attachInterrupt(iSensoCounterInterrupt, sensoCounterISR, CHANGE);
}


long  sensorPeriod() {
  return sensorCounter.period;
}
// ========== sensor code end ==========


// ======= speed adjustment begin =======
void speedSetup() {
  pinMode(LED_SLOW, OUTPUT);
  pinMode(LED_OK, OUTPUT);
  pinMode(LED_FAST, OUTPUT);
  iPeriod = eepromReadPeriod();
}


void speedUp() {
  pwmChangeDuty(iPwmDuty+1);
}


void speedDown() {
  pwmChangeDuty(iPwmDuty-1);
}


void speedAdjust(int period) {
  if (iPeriod + HYSTERESIS < period) {// speed up
    digitalWrite(LED_SLOW, HIGH);
    digitalWrite(LED_OK, LOW);
    digitalWrite(LED_FAST, LOW);
    if (iPwmDuty < 1023 ) {
      speedUp();
    } else {
      Serial.println( "*** can't speed up, maximum reached" );
    }
  }


  if (iPeriod - HYSTERESIS > period) {// speed down
    digitalWrite(LED_SLOW, LOW);
    digitalWrite(LED_OK, LOW);
    digitalWrite(LED_FAST, HIGH);
    if (iPwmDuty > 400 ) {
      speedDown();
    } else {
      Serial.println( "*** can't speed down, minimum reached" );
    }
  }


  if ((iPeriod - HYSTERESIS <  period) && (period < iPeriod + HYSTERESIS)) { // speed ok
    digitalWrite(LED_SLOW, LOW);
    digitalWrite(LED_OK, HIGH);
    digitalWrite(LED_FAST, LOW);
  }
}


// ======= speed adjustment end =======


// ========== eeprom storage begin ==============


void eepromWritePeriod(int period) {
  if(eepromReadPeriod() != period) { // prevent writing when not needed
    EEPROM.write(EEPROM_DUTY_ADDR, period >> 8);
    EEPROM.write(EEPROM_DUTY_ADDR + 1, period & 0xff);
  }
}


int eepromReadPeriod() {
  int lRet = EEPROM.read(EEPROM_DUTY_ADDR);
  lRet = lRet << 8;
  lRet |= EEPROM.read(EEPROM_DUTY_ADDR + 1);
  return (lRet);
}


// ========== eeprom storage end ==============


// ========== ARDUINO code begin ==========


void setup(void) {
  Serial.begin(9600);
  sensorSetup();
  speedSetup();
  pwmSetup();
  Serial.println("Ready for input...");
}

void loop(void) {

  int period = (int)(sensorPeriod()/100); // this is enough precision, want to keep to int


  while (Serial.available() > 0) {

    int iDesiredPeriod = Serial.parseInt();
    if (iDesiredPeriod > 10) {
      iPeriod = iDesiredPeriod;
     }


    if (iDesiredPeriod == 10) { // cmd 10 = store
      eepromWritePeriod(period);
      Serial.print("**** Stored period: ");
      Serial.println(period);
      period = eepromReadPeriod();
      Serial.print("**** Read back period: ");
      Serial.println(period);
     }

    if (iDesiredPeriod == 9) { // cmd 9 = stats
      Serial.println("**** Stats ****");
      Serial.print("**** Desired period: ");
      Serial.println(eepromReadPeriod());
      Serial.print("**** Measured period: ");
      Serial.println(period);
      Serial.print("**** PWM Duty Cycle: ");
      Serial.println(iPwmDuty);
     }

  }


  speedAdjust(period);
  delay(20);

}

// ========== ARDUINO code end ==========








 

Enough practical design. The table is spinning as it should now. From now on I'll focus on enchantement.

I'm also leaving my own comfort zone behind now. For the next steps I have no clue yet what they will be and how I'm going to build things.

 

End of Chapter 1

 

Photo 05-02-15 22 23 36.jpg

 

 

 

 

Table of Contents
Chapter 1: Fix the turntable
1: Perpetuum Ebner Musical 1
2: A Time to Kill and a Time to Heal
3: Preparation for Motor Drive
4: Motor control with Infineon Motor Shield and Arduino UNO
5: Turntable speed sample testbed with Arduino UNO
6: Turntable Speed Sensor design
7: Control Theory - End of Chapter 1
Chapter 2: First Enchantments
8: Digital Light Organ Enchantment
9: Autonomous Servo Lift
10: SMD Time - Solder the IR Speed Sensor PCB
11: Yelp - who can Help me to Compile and Run my First SAMA5D4 C Program
12: Son et Lumiere - End of Chapter 2
Chapter 3: Taming the Board
13: Breakthrough - Run my own C++ Program on the SAMA5D4
14: Digital Light Organ Input Buffer
15: SAMA5D4 Blinky
16: Scope Creep
17: Audio Sampling with 16-bit ADC ADS8343
18: Sending Files to SAMA5D4 over USB
19: Port my Light Organ from Arduino to SAMA5D4
20: Fast Fourier Transform on the SAMA5D4 - End of Chapter 3
Epilogue: Reaching for the Clouds
21: Right-Sizing my Plans
22: My Own C++ Buffered Sampler on the SAMA5D4
Interlude
23: Building In the Motorized Light Organ
24: Up to the Clouds with Yún
25: Publish or Perish
26: Turntable Finished
Stretch & Boni
Bonus 1a: Remote Light Organ with WiFI pt. 1
Bonus 1b: Remote Light Organ with WiFI pt. 2
Grande Finale: Paho MQTT Client on the SAMA5D4
Related blog
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958
Review 1: Atmel SMART SAMA5D4 Xplained Ultra Unboxing and First Steps
Review 2: Atmel SMART SAMA5D4 Xplained Ultra - Building the Libraries from Source
Review 3: Digital Continuous Rotation (360°) Servo Part 1
Review 4: Digital Continuous Rotation (360°) Servo Part 2
Review 5: Atmel SMART SAMA5D4 Xplained Ultra - TCP/IP running
Review 6: Atmel SMART SAMA5D4 Xplained Ultra - LINUX Distro with SSH support
poem
Enchanted Objects: Let's work together to tame the ATMEL SMART SAMA5D4 Xplained Ultra kit
17 bis: Off South...
Review 7: Atmel SMART SAMA5D4 Xplained Ultra - C++ ADC Example on Linux
Review 8: Atmel SMART SAMA5D4 Xplained Ultra - Product Review
Review 9a: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 1
Review 9b: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 2
Review 10: Atmel SMART SAMA5D4 Xplained Ultra - New Content on AT91.com
1958 Turntable from the Black Forest - Summary of the Enchanted Player Story

20150326.jpg

 

 

The basis for my turntable enchantment is almost done. I'm very close to having a working turntable.

Let's have a look at the speed sensor circuit today. One of the very last things to complete for this basis part.

Photo 27-03-15 15 53 01.jpg

The Speed Sensor

 

The sensor is an infrared opto-coupler. It was component of a 'for parts' video recorder.

sensor.jpg

 

I've placed one of those under the stepped pulley of the Perpetuum-Ebner. I painted the underside of that pulley in a non-reflective color.

Then I glued a small piece of mirror (it's actually a piece of shiny foil that I removed from a toy of one of my girls) on that.

The infrared transmitter is always on.

When the mirror is above the coupler, the receiver conducts. When the mat paint is above the pair, it goes into high resistance..

 

sensorprinciple.jpg

The Sensor Circuit

 

My sensor circuit has two duties. It has to power the tx, and it has to translate the state change of the receiver into a signal that we can feed into the Arduino.

 


Powering the IR light sender is easy. In this circuit, it's always on. We'll power it from the Arduino's 5 V.

sensor_driver.png

With the setup above, we'll get a constant IR beam pointing to the underside of the pulley.

 

tip: you can see that an IR LED is emitting light by looking at it with a digital camera.

 

IRPHOTO.jpg

 

The receiver is set up as a voltage divider.

sensor_receiver.png

When the light is not reflected, the receiver's internal resistance is much higher than the 10K resistor in series.

The effect is that almost all of the 5 V source will be over that receiver.

So the signal is high when the mirror is not above the opto-coupler.

 

When the mirror is above the sender and receiver, the beam of the sender reaches the receiver. Its internal resistance is low when agitated by the beam.

In that case, the 10K series resistor is the dominant component, and most of the 5 V  source will be over that resistor.

The voiltage over the receiver will be close to 0 V.

So the signal is low when the mirror is above the opto-coupler.

 

I have added an inverting amplifier to that output. It's just your usual high gain one-transistor setup.

sensor_amplifier.png

The high gain will do a few things with the signal. It removes a bit of the noise when the infrared beam bounces against the dark part of the pulley.

The paint is not evenly applied (it is actually just blue sharpie ink). The transistor is driven into full saturation when its input driven.

So the noisy high input signal becomes a clean low signal (inverting amp!) at the output.

The second achievement of the amplifier is to make the edges of the signal sharper. The high gain takes care that the transistor is quickly switched on and off.

fall time.jpg

 

This turns the analog input signal into a nice digital one.

 

output after the amplifierzoom in of one amplified pusle
sensorrightspeed.jpgsensorpulse.jpg

 

 

The Prototypes

 

I've made two prototypes. The first one on a breadboard, so that I could test the firmware, tweak some values and make design changes if needed.

prototypes.jpg

And as a temporary solution that I can build into the table, I've soldered the circuit on Veriboard.

This is really temporary. I'm making a tiny SMD print for the final sensor circuit.

 

The Final Sensor Board

 

3d.png

 

I've made a PCB design in KiCAD. I've made a choice a while ago to never ever return to through-hole, so this is an SMD design.

The KiCAD sources, and the fab files for OSH Park are attached. I've designed the PCB for hand soldering.

 

This is the schema:

schema_kicad.png

 

 

And this is the PCB layout:

pcb_kicad.png

I settled for a single side design. If I'd take the proper time to make a double sided design, I believe I could reduce the size to little more than what's needed for the headers.

 

The gallery shows a few of the previews that OSH Park presents when you upload the fab files.

I like that they show all aspects of how your board will look like after production. Some errors like drilling hole mismatches show very well in their report.

I always take the time to review the OSH Park rendering before committing the funding for the PCB.

 

 

{gallery} OSH Park PCB preview

large_i (1).png

Preview 1:PCB back

large_i (6).png

Preview 5: can't remember

large_i (7).png

Preview 6: can't remember

large_i (8).png

Preview 7: Component outline

large_i.png

Preview 9: PCB front

 

It will take at least 15 days for the PCB to arrive. Meanwhile the Veroboard proto will do the sensor duty.

 

 

Side story: Perpetuum Ebner

 

The two Steidinger brothers were born in a watchmaker family. It's only natural that their first steps in the industry were watch related.


The Black Forest watch making tradition is very different from what was happening in Swiss at the time. In Swiss, they were specializing in wristwatches. There was a thriving industry then, and there is still one now.

In the Black Forest, the clock industry was evolving around furniture clocks. The mechanics were only one part of the work. There was also a big woodworking guild that specialized in the typical rustique cabinets that we still link to that region. The cuckoo clock may be the best known article.


The brothers were making mechanical parts for those clocks. Each on their own, in their own small start-up.

In their spare time they started to experiment with early phonograph mechanisms. The early record player designs shared quite some things with clocks. The feather motor that powered so many clocks at the time was also used by the first phonograph manufactures.


The Steidingers were looking for options to broaden their gamma. Business was not great in the pre-war era. If they only could find something that made more money than those clock parts, where the competition was fierce.

Almost every village had a clockwork workshop. But no one was in the phonograph business yet.

 

 

Table of Contents
Chapter 1: Fix the turntable
1: Perpetuum Ebner Musical 1
2: A Time to Kill and a Time to Heal
3: Preparation for Motor Drive
4: Motor control with Infineon Motor Shield and Arduino UNO
5: Turntable speed sample testbed with Arduino UNO
6: Turntable Speed Sensor design
7: Control Theory - End of Chapter 1
Chapter 2: First Enchantments
8: Digital Light Organ Enchantment
9: Autonomous Servo Lift
10: SMD Time - Solder the IR Speed Sensor PCB
11: Yelp - who can Help me to Compile and Run my First SAMA5D4 C Program
12: Son et Lumiere - End of Chapter 2
Chapter 3: Taming the Board
13: Breakthrough - Run my own C++ Program on the SAMA5D4
14: Digital Light Organ Input Buffer
15: SAMA5D4 Blinky
16: Scope Creep
17: Audio Sampling with 16-bit ADC ADS8343
18: Sending Files to SAMA5D4 over USB
19: Port my Light Organ from Arduino to SAMA5D4
20: Fast Fourier Transform on the SAMA5D4 - End of Chapter 3
Epilogue: Reaching for the Clouds
21: Right-Sizing my Plans
22: My Own C++ Buffered Sampler on the SAMA5D4
Interlude
23: Building In the Motorized Light Organ
24: Up to the Clouds with Yún
25: Publish or Perish
26: Turntable Finished
Stretch & Boni
Bonus 1a: Remote Light Organ with WiFI pt. 1
Bonus 1b: Remote Light Organ with WiFI pt. 2
Grande Finale: Paho MQTT Client on the SAMA5D4
Related blog
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958
Review 1: Atmel SMART SAMA5D4 Xplained Ultra Unboxing and First Steps
Review 2: Atmel SMART SAMA5D4 Xplained Ultra - Building the Libraries from Source
Review 3: Digital Continuous Rotation (360°) Servo Part 1
Review 4: Digital Continuous Rotation (360°) Servo Part 2
Review 5: Atmel SMART SAMA5D4 Xplained Ultra - TCP/IP running
Review 6: Atmel SMART SAMA5D4 Xplained Ultra - LINUX Distro with SSH support
poem
Enchanted Objects: Let's work together to tame the ATMEL SMART SAMA5D4 Xplained Ultra kit
17 bis: Off South...
Review 7: Atmel SMART SAMA5D4 Xplained Ultra - C++ ADC Example on Linux
Review 8: Atmel SMART SAMA5D4 Xplained Ultra - Product Review
Review 9a: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 1
Review 9b: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 2
Review 10: Atmel SMART SAMA5D4 Xplained Ultra - New Content on AT91.com
1958 Turntable from the Black Forest - Summary of the Enchanted Player Story
amgalbu

MagicHat - 3 - Accelerometer

Posted by amgalbu Top Member Mar 26, 2015

In order to detect when the MagicHat is picked up from the docking station, an accelerometer will be installed.

The accelerometer I will install is a quite old model, now out of production: the ADXL210. The reason for this choice is that it was the only available in my lab and I decided to use it even if it reminds me one the most disastrous project of my engineering life: a washing machine dynamic balancing device, which reveals to be a self-destroying device... I hope this project will be a bit more lucky than that one...

 

03 - ADXL Front.jpg

 

Back to technical topics, The ADXL210 is low cost complete 2-axis accelerometers with a measurement range of /±10 g. The ADXL210 can measure both dynamic acceleration (e.g., vibration) and static acceleration (e.g., gravity). The outputs are digital signals whose duty cycles (ratio of pulsewidth to period) are proportional to the acceleration in each of the 2 sensitive axes. These outputs may be measured directly with a microprocessor counter. However, in my case a voltage output is desired since I don't have other input capture timers available (I'm going to use the only input capture available on Arduino Yun for reading the temperature sensor). Fortunately, a voltage output proportional to acceleration is available from the XFILT and YFILT pins, or may be reconstructed by filtering the duty cycle outputs. I chose the first option, since with Arduino it's very easy to read an analog input

 

03 - Accelerometer.png

 

03 - ADXL Back.jpg

 

The board will be mounted so that the X axis measure is vertical

 

03 - Axis.png

03 - ADXL Axis.jpg

 

The output from accelerometer will read using the usual Arduino function analogRead and values will be averaged to filter out a bit of the analog noise.

The filtered values will be then analyzed to determine if the MagicHat is handles without any care for its...age!

I would like to start by thanking everyone involved in making this design challenge happen. Things like this are great for the electronics community and are one of the reasons I got insterested in electronics. Thank you.

 

Problem: I don't check my inbox on Element 14 for new messages at regular intervals. This leads to messages either sitting around for a few days or me checking in to find only an empty inbox.

Solution: Repurpose an old analogue rapiest multimeter to display the number of messages in my inbox via the voltage indicator.

IMG_20150302_181900.jpg

/\ fig 1 This is the meter I want to use, along with some objects for scale

IMG_20150302_191520.jpg

/\ fig 2 And here we have a photo of the meters circuitry

 

Hardware Design: The idea is to drive the display using a motor driver board and PWM. Conveniently the meter has a range of about 12 volts so a standard DC wall wart should be fine for powering this This does mean that the device can't display more than 12 messages, but hopefully I will check in regularly enough for this not to be an issue. Any values greater than 12 can easily just be have to be displayed as 12, or alternatively by a needle alternating between 0 and 12. The wall wart could also power the main board of the unit via a voltage regulator. For the main board I intend to use an Arduino Yun. The meter will conveniently operate on DC voltage mode with no power source so powering it will not be an issue. It also features 2 convenient side mounted switches that can easily be used to turn the unit on and off. It may also be worth adding an LED backlight to the unit that can be driven by the Yun and turned off with the other switch.

Post meter design.png

/\ fig 3 A quick visual overview of the hardware. Note that for simplicity, some passive components and the switches and the circuitry from the multimeter have been ommited.

 

Software design: The first stage of software will run on the Linux half of the Yun. Using Python it will regularly load and parse my inbox to find the message count. this will then be passed on to the ATmega. The mega will compare the value it receives to a table of PWM values and then use this to power the motor driver and move the needle to the correct position, or possibly between positions in the case of more than 12 posts, but this will be handled as a special case. The Yun can also drive the backlight with PWM, potentially allowing for either a heartbeat effect or a brightness increasing with message count.

 

Success Criteria: I will deem the project a success if:

•It can accurately and reliably display the number of messages in my inbox up to 12

•The system can cope with more than 12 messages in a way that does not result in catastrophic failure

•The display can be read in darkness with an LED backlight

•The unit is powered by a single DC wall wart

 

Challenges in this project:

• Writing the code for the parser

   -Whilst I do have some experience of python, I have only coded something like this once in the past

•Calibrating the pwm

   -I will probably needs a separate program to test pwm values via a serial terminal. I will probably use an arduino Leonardo for this, simply because I feel more confident     using it

•Comunicating between Linux and the Atmega

   -Having never used a Yun, this appears to be one of the challenges specific to the platform

 

Edit: Apologies for the delay in posting this. I have recently changed my PC and have been having some issues posting. These issues have not yet been resolved, but I am now able to post through another device so updates should now be a little more frequent.

20150325.jpg

 

I'm creating a test setup for the speed sample firmware.
In this post I'm reviewing the speed sensing approach and how the Arduino knows how fast the turntable is spinning.

 

Photo 25-03-15 19 30 59.jpg

 

Where should I measure the speed?

 

There are a number of options. The table has 5 parts where the speed can be measured.

 

tabledrawing.jpg

  • motor: should run at a constant speed all the time, regardless of the selected turntable speed
  • belt: constant
  • stepped pulley: constant
  • idler: dependent on selected speed, moves up and down depending on speed too
  • turntable platter: dependent on selected speed.

 

As it turns out, the easiest candidate is the stepped pulley. Its speed should be constant regardless of the selected platter speed, and it is easy to attach a sensor under it.

For a more detailed explanation of how the record player works, speed calculations and selection of the speed sensor, have a look at these posts:

Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958 - part 2 - Calculating the Motor Speed

Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958 - part 7 - Make Speed Sensor from Scrap Parts

Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958 - part 8 - Sample the Motor Speed with Microcontroller

 

The gist of all the above is that I'm going to measure the speed of that stepped pulley with an infrared sender - receiver pair.

A small piece of mirror glued to the underside of the pulley will reflect the IR beam once per rotation.

We'll get a nice digital signal from that sensor with the same frequency as the pulley speed.

 

More on that in a next post.

The only thing we have to remember for now that that pulley is going to spin at a few 10's of RPMs.

 

Simulating the Speed Sensor

 

We know that the sensor is going to give a signal with the frequency of the spinning pulley.

The signal will be high when the mirror is in front of the IR sensor, and low for the rest of the rotation. The width of the small mirror defines the duty cycle of our sensor output.

 

It's easy to simulate that signal with a signal generator with TTL output and variable duty cycle.

If we set that to a signal within the speed range of that pulley (I've selected 12.5 Hz in my test setup here), and play a bit with the duty cycle, we have a signal that is very similar to the sensor output.

We can change the functuon generator frequency to simulate that the turntable is slowing down or going too fast.

We can play with the duty cycle to test that our firmware will sample the frequency correctly in the real world, and find the minimum size of the mirror.

 

Photo 25-03-15 19 32 39.jpg

 

The Speed Sample Firmware

 

I've looked at several frequency measure examples for the Arduino.

I selected the first one that works together with my PWM solution for the motor driver (1958 Turntable from the Black Forest - 4: Motor control with Infineon Motor Shield and Arduino UNO).

It is avdweb Frequency / period counter for the Arduino.

You can use this library in polling mode (do a measurement when you need it) or in interrupt mode. I chose interrupt mode.

 

In interrupt mode, the frequency polling will happen in the interrupt handler when the sensor signal changes.

Whenever we need to know the speed, we can just look up the value that was collected in the interrupt.

There are only a few pins that can be used with interrupts. You can find more info on the attachInterrupt() help page.

 

The library is not hard to use. This is how you initialize it:

 

// includes for sensor
#include <FreqPeriodCounter.h>

// ...

// variables and constant for sendor
const byte iSensorPin = 3;
const byte iSensoCounterInterrupt = 1; // = pin 3
FreqPeriodCounter sensorCounter(iSensorPin, micros);









 

The next step is to set up the interrupt mechanism. We have a handler that's called when the value on pin 3 changes.

We have to register that handler. And that's it. From that moment the frequency measurement is working.

 

void sensoCounterISR() {
  sensorCounter.poll();
}

void sensorSetup() {
  attachInterrupt(iSensoCounterInterrupt, sensoCounterISR, CHANGE);
}








 

We can get at the last measured frequency anytime. I've created this method for that:

 

long  sensorPeriod() {
  return sensorCounter.period;
}








 

I'm using the period because that's not a floating point. Frequency is 1/period, and that's a float.

For my use, I can work with both period and frequency. Both indicate how fast the table is spinning.

So I avoided the requirement to link in the floating point libraries by sticking with period.

 

That's all.

For testing purposes, I'm logging the period in the main loop of my firmware.

When I change the frequency of my function generator, the Arduino serial monitor has to display the correct period.

When I change the duty cycle on my function generator, the Arduino should ignore that and keep showing the correct period.

 

void setup(void) {
  Serial.begin(9600);
  sensorSetup();

  // ...
}

void loop(void) {

    // ...

  long period = sensorPeriod();
    Serial.println(period);
    delay(1000);
}








 

The Results

 

In the photos and captures below, you can see the results.

The figures on the frequency counter, oscilloscope and Arduino serial monitor match within a reasonable margin.

 

Frequency counterOscilloscopeArduino sampled values
Photo 25-03-15 19 30 59.jpgspeedsensor.bmpsensorcount.png

 

Let's have a closer look at that oscilloscope capture:

 

speedsensor_big_annotated.jpg

This is an odd capture. The two signals don't have the same time base (one is 33 kHz, the second 15.5 Hz - and still both show stable and well-triggered on the scope).

This is called alternate trigger mode. It's used to show to signals that don't relate to each other in the time dimension.

 

I want to show the PWM signal of my motor control on the oscilloscope to validate that my sample firmware does not impact the motor drive firmware.

So any change of my frequency generator should leave the upper part of the scope unchanged.

Vise versa, if I change the PWM of the motor driver, the sample firmware should still measure the sensor signal correctly.

 

The alternate trigger technique is a good method to show this. You can see if altering one signal has impact on the other.

But don't try to relate the signals to each other. You have to see this display as 'split screen'. Upper and lower part have a different timeline and trigger point.

 

More on the subject of alternate triggers in this video:

 

 

In the next post, I'm going to build the sensor and do real world tests.

 

 

Table of Contents
Chapter 1: Fix the turntable
1: Perpetuum Ebner Musical 1
2: A Time to Kill and a Time to Heal
3: Preparation for Motor Drive
4: Motor control with Infineon Motor Shield and Arduino UNO
5: Turntable speed sample testbed with Arduino UNO
6: Turntable Speed Sensor design
7: Control Theory - End of Chapter 1
Chapter 2: First Enchantments
8: Digital Light Organ Enchantment
9: Autonomous Servo Lift
10: SMD Time - Solder the IR Speed Sensor PCB
11: Yelp - who can Help me to Compile and Run my First SAMA5D4 C Program
12: Son et Lumiere - End of Chapter 2
Chapter 3: Taming the Board
13: Breakthrough - Run my own C++ Program on the SAMA5D4
14: Digital Light Organ Input Buffer
15: SAMA5D4 Blinky
16: Scope Creep
17: Audio Sampling with 16-bit ADC ADS8343
18: Sending Files to SAMA5D4 over USB
19: Port my Light Organ from Arduino to SAMA5D4
20: Fast Fourier Transform on the SAMA5D4 - End of Chapter 3
Epilogue: Reaching for the Clouds
21: Right-Sizing my Plans
22: My Own C++ Buffered Sampler on the SAMA5D4
Interlude
23: Building In the Motorized Light Organ
24: Up to the Clouds with Yún
25: Publish or Perish
26: Turntable Finished
Stretch & Boni
Bonus 1a: Remote Light Organ with WiFI pt. 1
Bonus 1b: Remote Light Organ with WiFI pt. 2
Grande Finale: Paho MQTT Client on the SAMA5D4
Related blog
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958
Review 1: Atmel SMART SAMA5D4 Xplained Ultra Unboxing and First Steps
Review 2: Atmel SMART SAMA5D4 Xplained Ultra - Building the Libraries from Source
Review 3: Digital Continuous Rotation (360°) Servo Part 1
Review 4: Digital Continuous Rotation (360°) Servo Part 2
Review 5: Atmel SMART SAMA5D4 Xplained Ultra - TCP/IP running
Review 6: Atmel SMART SAMA5D4 Xplained Ultra - LINUX Distro with SSH support
poem
Enchanted Objects: Let's work together to tame the ATMEL SMART SAMA5D4 Xplained Ultra kit
17 bis: Off South...
Review 7: Atmel SMART SAMA5D4 Xplained Ultra - C++ ADC Example on Linux
Review 8: Atmel SMART SAMA5D4 Xplained Ultra - Product Review
Review 9a: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 1
Review 9b: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 2
Review 10: Atmel SMART SAMA5D4 Xplained Ultra - New Content on AT91.com
1958 Turntable from the Black Forest - Summary of the Enchanted Player Story

For measuring body temperature, I need a sensor with a 0.1 °C accuracy (i.e. the accuracy you typically have in a thermometer).

Unfortunately, the sensor I initially thought of (the Melexis 96104 Infrared thermometer) does not match this requirement, neither do any of the other Infrared thermometer available on the market.

The main advantage of a infrared thermometer is that it can make measurements without the need to put the sensor in contact with the skin. Because of this lack of accuracy, I have to switch to a standard temperature sensor. After some researches, I found the TSic 506 sensor. The most interesting features of this sensor are

  1. it has an accuracy of 0.1 °C (and the best precision is reached at 40 °C, which is good when you have to measure body temperature)
  2. it does not require calibration
  3. it has a digital output, which simplifies the circuit because there is no need for and external signal conditioning logic

 

ZACwire protocol

The output is sent out using a very simple protocol: the ZACwire protocol. These are the protocol rules

  • Each byte has a standard format: a start bit, 8 data bits and a parity bit.

02 - ZACwire packet.png

  • The output signal is normally high.
  • Each bit transmission starts with a falling edge.
  • A bit is a "0" or a "1" depending on the amount of time the output stays low. To determine whether a bit is "0" or "1", the time the signals stays needs to e compared with the low time of the start bit (commonly referred as TStrobe)

02 - ZACwire Bits.png

02 - ZACwire scope.png

  • The parity bit provides error detection by adding an even parity bit. This means that if the number of "1" bits in the 9 packet bits (8 data bits + 1 parity bit) has to be even

 

There is a ZACwire library available on the Arduino playground, but it uses a polling technique. Basically it stays stuck in a loop reading the digital input pin. I decided to improve a little bit this library by implementig the ZACwire protocol using the Input Capture capabilities available on Arduino Yun

 

Some background

A timer  is a piece of hardware built in the Arduino controller. It is like a clock, and can be used to measure time events.

The Arduino Yun board is based on the Atmel AVR ATmega328 microchip. It has 3 timers, called Timer0, Timer1 and Timer2. Timer0 and Timer2 are 8bit timer, where Timer1 is a 16bit timer.

The most important difference between 8bit and 16bit timer is the timer resolution. 8bits means 256 values (two to the power of 8) where 16bit means 65536 values (two to the power of 16) which is much higher resolution.

All timers depends on the system clock of your Arduino system. Normally the system clock is 16MHz, but the Arduino Pro 3/3V is 8Mhz, so be careful when writing your own timer functions.
The timer hardware can be configured with some special timer registers. In the Arduino firmware, all timers were configured to a 1kHz frequency and interrupts are generally enabled. From our point of view, the most important timer-related registers are the following

  • TCCRx - Timer/Counter Control Register. The pre-scaler can be configured here.
  • TCNTx - Timer/Counter Register. The actual timer value is stored here.
  • OCRx - Output Compare Register
  • ICRx - Input Capture Register (only for 16bit timer)
  • TIMSKx - Timer/Counter Interrupt Mask Register. To enable/disable timer interrupts.
  • TIFRx - Timer/Counter Interrupt Flag Register. Indicates a pending timer interrupt.

 

The program running on a controller is normally running sequentially instruction by instruction. An interrupt is an external event that interrupts the running program and runs a special interrupt service routine (ISR). After the ISR has been finished, the running program is continued with the next instruction. Instruction means a single machine instruction, not a line of C or C++ code.

Before an pending interrupt will be able to call a ISR the following conditions must be true:

  • Interrupts must be generally enabled
  • the according Interrupt mask must be enabled

Interrupts can generally enabled or disabled with the function interrupts() ornoInterrupts(). By default in the Arduino firmware interrupts are enabled. Interrupt masks are enabled / disabled by setting or clearing bits in the Interrupt mask register (TIMSKx).

When an interrupt occurs, a flag in the interrupt flag register (TIFRx) is been set. This interrupt will be automatically cleared when entering the ISR or by manually clearing the bit in the interrupt flag register.

The Arduino functions attachInterrupt() and detachInterrupt() can only be used for external interrupt pins. These are different interrupt sources, not discussed here, and cannot be used for input capture interrupts

A timer can generate different types of interrupts.

  • Timer Overflow:Timer overflow means the timer has reached is limit value. When a timer overflow interrupt occurs, the timer overflow bit TOVx will be set in the interrupt flag register TIFRx. When the timer overflow interrupt enable bit TOIEx in the interrupt mask register TIMSKx is set, the timer overflow interrupt service routine ISR(TIMERx_OVF_vect) will be called.
  • Output Compare Match: When a output compare match interrupt occurs, the OCFxy flag will be set in the interrupt flag register TIFRx . When the output compare interrupt enable bit OCIExy in the interrupt mask register TIMSKx is set, the output compare match interrupt service ISR(TIMERx_COMPy_vect) routine will be called.
  • Timer Input Capture: When a timer input capture interrupt occurs, the input capture flag bit ICFx will be set in the interrupt flag register TIFRx. When the input capture interrupt enable bit ICIEx in the interrupt mask register TIMSKx is set, the timer input capture interrupt service routine ISR(TIMERx_CAPT_vect) will be called.

The latter what we will leverage for implementing the ZACwire protocol

 

Let's start coding

Flowchart below depicts the ISR routine is going to be implemented

 

02 - Flowchart ISR.png

 

Defining the Input Capture ISR routine is quite simple: just add a function like this

 

ISR(TIMER1_CAPT_vect) {
 // ISR code here
 }

 

 

But first of all, we need to properly setup Input Capture hardware

 

 

       // Input Capture setup
       // ICNC1: Enable Input Capture Noise Canceler
       // ICES1: =1 for trigger on rising edge (in this case we are interested 
       //           in the falling edge
       // CS10: =1 set prescaler to 1x system clock (F_CPU)
       TCCR1A = 0;
       TCCR1B = (0<<ICNC1) | (0<<ICES1) | (1<<CS10);
       TCCR1C = 0;

       // Interrupt setup
       // ICIE1: Input capture 
       // TOIE1: Timer1 overflow
       TIFR1 = (1<<ICF1) | (1<<TOV1);          // clear pending
       TIMSK1 = (1<<ICIE1) | (1<<TOIE1); // and enable

 

Once the timer has been initialized, we can start implementing the ISR routine

We will use an helper variable (rising) to determine whether we are catching a rising or a falling edge and a bunch of static variables to store ISR's state machine current status


byte waitingForStartBit = 1;
byte rising = 0;
byte bitCounter = 0;
int currByte = 0;
byte byteCounter = 0;
byte bytes[10];
byte bytesReady = 0;
byte expectedBytes = 2;
int tStrobe;

 

The implementation of the ISR method is a simple porting of the flowchart


ISR(TIMER1_CAPT_vect) {
       byte l = ICR1L;            // grab captured timer value
       byte h = ICR1H;
       int pulse;

       if (rising)
       {
             // rising edge
             if (waitingForStartBit)
             {
                    // store strobe duration
                    tStrobe = (h << 8) + l;

                    // reset status variables
                    waitingForStartBit = 0;
                    bitCounter = 0;
                    currByte = 0;
             }
             else
             {
                    // compute pulse duration
                    pulse = (h << 8) + l;

                    // append new bit 
                    currByte <<= 1;
                    if (pulse >= (tStrobe * 3) / 4))
                           currByte |= 0x01;

                    bitCounter ++;
                    if (bitCounter == 9)
                    {
                           // all bits (including parity bits) read
                           if (checkParity(currByte))
                           {
                                  // remove parity bit
                                  currByte >>= 1;

                                  // enqueue byte
                                  bytes[byteCounter] = currByte;

                                  // increment byte counter
                                  byteCounter ++;
                                  if (byteCounter >= expectedBytes)
                                  {
                                        // no more bytes to read: disable interrupts
                                         TIMSK1 &= ~((1<<ICIE1) | (1<<TOIE1));
                                        bytesReady = 1;
                                  }
                           }

                           // start waiting for start bit of the next byte
                           waitingForStartBit = 1;
                    }
             }

             // set falling edge interrupt
             TCCR1B &= ~(1<<ICES1);
             rising = 0;
       }
       else
       {
             // falling edge
             // set rising edge interrupt
             TCCR1B |= (1<<ICES1);
             rising = 1;
       }
}

 

When temperature has to be read out from the TSic sensor, user will call a function like this

 

void getTemperature()
{
       waitingForStartBit = 1;
       rising = 0;
       bitCounter = 0;
       currByte = 0;
       byteCounter = 0;
       bytesReady = 0;
       expectedBytes = 2;
       
       // switch on TSic sensor
       // TODO

       initTimer();
}

 

and, in the main loop, will periodically check to see if the bytesReady variable has been set to 1. When bytesReady is 1, data in the bytes array can be converted to the actual temperature according to the formula (from TSic datasheet)

 

int sensorValue = (bytes[0] << 8) + bytes[1];
float celsius = ( (float)sensorValue/ 2047 * 7000) - 1000;

 

where celsius stores the current temperature value (in Celsius) multplied by 10

"That” said Matilda, "is not good". Hans looked nervously over the top of Network Security for dummies. He knew that tone of voice and the daughter of a miner is not one to be trifled with.

 

Matilda held up her mechanism and Hans saw the distinct arc transcribed onto the paper. "Oh" he said.

Arc.jpg

Several hours later, later the floor was deep in cardboard scraps and scrumpled paper. Matilda looked despondent. "Perhaps the Historical society might be able to help” suggested Hans.

 

The next morning Matilda headed up the back stairs of the town hall. There, behind the reference library was a small door marked "Historical society”. Behind the small door was a small room piled high with boxes and papers. On a desk she saw the model locomotive from the faire. "Can I help" asked a voice from behind the model. A bespectacled man's face popped up from under the desk. Matilda explained her predicament. "Ah yes" said the man, ”that's a problem engine designers took years to crack. It wrecks the engine efficiency to the point we could not get our model to run". He pointed to a small electric motor attached to the bottom of the model. "Go next door to the reference library and ask for a book on Watt's Linkage” he suggested.

Watts_linkage.gif

 

 

Matilda returned home with a spring in her step and a book under her arm. She quickly made a model of the linkage and confirmed it did indeed generate the desired motion. She silently thanked Mr Watt for his fantastic solution.

Linkage.jpg

Next Enchanted Objects Design Challenge - The Woodcutter and the Blacksmith

The genie being proud in nature, wished to show off his sweet new crib. He would like to invite all of you to an informal open house, where you can see his sweet new setup, and all his cool furniture. Arduino Yun was the architect of the genies sweet new living quarters. Mr. Infineon was the electrician. He wired the building to be as bright as the sun, but Mr. Infineon was also a good guy and wanted the energy consumption to be minimized, and allowed this through his setup. The lamp itself looks like it is a normal 60W bulb, shines just as bright too, but it only a 12V/15W bulb! Also the lamp doesn't have to be much larger than the average lamp, since the power required to power both units is minimal. So from the genie, "Welcome to my Magic Lamp!"

                                                    MagicLamp.jpg

20150324.jpg

 

Time for the first electronics post. We're going to drive my turntable motor with the Arduino Uno and the Infineon motor shield.

 

referencedesign.jpg

The Infineon DC Motor Control Shield is connected to the Arduino UNO. The Arduino controls the motor power by sending PWM signals to the shield.

The duty cycle of the PWM defines how much power is going to the motor. I'm using that technique to speed up and slow down the motor.

 

The signal

 

The Arduino is generating the PWM signal. When you drive a motor with PWM, it's not the frequency that drives the motor speed, but the duty cycle of the signal.

pwm.jpg

 

The easiest way to get a PWM signal on an Arduino with variable duty cycle is by calling analogWrite().

There's noting wrong with that for most applications, but it's not ideal for my project.

The frequency of this standard method is somewhere between 900 and 1000 Hz. And that is in the audio range.

I risk getting my turntable's signal polluted by the PWM signal.

 

To mitigate that, I used a library that supports higher frequency PWM: the Timer1 lib.

 

The Timer1 Arduino library

 

This library allows me to lift the PWM frequency above the frequencies that we can hear (if you are not a bat).

I settled for 33.3 kHz (a period of 30 µs).

 

#include <TimerOne.h>

const byte PWMpin = 9; // PWM only supported on pin 9 or 10
const byte INH_1 = 11;
int iDC = 705; // exact speed at 10 volt

void setup(void) {
  // ...
  pinMode(PWMpin, OUTPUT);  
  pinMode(INH_1, OUTPUT);
  Timer1.initialize();
  Timer1.pwm(PWMpin, iDC, 30); // duty cycle [10 bit], period [us] <8388480
  digitalWrite(INH_1, HIGH); // enable OUT1
}











 

I define two pins as outputs here:

truth.jpg

Pin 9 is connected to the half H-Bridge IN port. This is the PWM input that will control how much energy the motor shield sends to the motor.

Pin 11 connects to the half H-Bridge INH port. Driving this one low will stop the motor, whatever we do with pin 9.

 

Then we tell the library to generate a 33 kHz signal on pin 9, with a duty cycle of 705.

The duty cycle range goes from 0 to 1023. So you have to interpret this 705 as (705/1023)*100 = 68%.

I've chosen 705 because that gives me a correct turntable speed when I supply 10 V to the motor shield.

 

 

The pictures below show the PWM signal at different duty cycles.

The signal is probed at pin 9 of the Arduino.

 

200511676
pwm_200-1023.bmppwm_511-1023.bmppwm_767-1023.bmp

 

Test Bed

 

I've extended my sketch to make the duty cycle variable. You can enter a duty cycle in the Arduino IDE serial monitor, and that value is then sent to the Timer1 lib.

 

void setup(void) {
  Serial.begin(9600);
  // ...
  Serial.println("Ready for input...");
}

void loop(void)
{
  while (Serial.available() > 0) {
    // look for the next valid integer in the incoming serial stream,
    // between 5 and 1023,
    // < 5 is no signal, > 1023
    iDC = Serial.parseInt();
    Timer1.setPwmDuty(PWMpin, iDC);
    Serial.println(iDC);
  }
}









 

The setPwmDuty() immediately changes the duty cycle, and alters the motor speed.

This is an ideal test bed to exercise the motor driver design.

 

testbed.jpg

 

The Result

 

With the firmware ready and everything wired up, let's have a look at some results.

 

IMG_4353.JPG p002.JPG

The picture below shows the input and output signal of the shield at a duty cycle of 705 (68%).

The yellow signal is probed at pin 9 of the Arduino. The blue signal is measured at out1 of the shield.

pwm_infineon_in_out_cursor.bmp

You can see the switching time on the capture. i've highlighted it with the two vertical cursors. I measured 4.40 µs.

You can find a more detailed review of the shield and the signals  in Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958 - part 3 - Infineon Motor Driver shield.

 

The Limits

 

The shield doesn't work from 0 to 100%. I've used the test bed to measure the working range in my circuit and with my firmware.

It's dependent on the frequency. The half H-Bridge needs time to switch on and off. So the total period of a PWM signal plays a role in the upper and lower limits.

I hit them around 10% and 86%. You can see that in the captures below.

 

In each of the captures, the blue signal is the output just outside the working range.

The white signal is a stored signal just within the range.

 

Lower limitUpper limit
lowerlimit.bmpupperlimit.bmp

 

You can see that the output signal flatlines in both situations. The output under 10% is 0 V, above 86% it's the input voltage of the shield (give and take some).

 

 

Voila. The motor drive part is finished. I'm now ready to start with the speed detector.

 

 

Table of Contents
Chapter 1: Fix the turntable
1: Perpetuum Ebner Musical 1
2: A Time to Kill and a Time to Heal
3: Preparation for Motor Drive
4: Motor control with Infineon Motor Shield and Arduino UNO
5: Turntable speed sample testbed with Arduino UNO
6: Turntable Speed Sensor design
7: Control Theory - End of Chapter 1
Chapter 2: First Enchantments
8: Digital Light Organ Enchantment
9: Autonomous Servo Lift
10: SMD Time - Solder the IR Speed Sensor PCB
11: Yelp - who can Help me to Compile and Run my First SAMA5D4 C Program
12: Son et Lumiere - End of Chapter 2
Chapter 3: Taming the Board
13: Breakthrough - Run my own C++ Program on the SAMA5D4
14: Digital Light Organ Input Buffer
15: SAMA5D4 Blinky
16: Scope Creep
17: Audio Sampling with 16-bit ADC ADS8343
18: Sending Files to SAMA5D4 over USB
19: Port my Light Organ from Arduino to SAMA5D4
20: Fast Fourier Transform on the SAMA5D4 - End of Chapter 3
Epilogue: Reaching for the Clouds
21: Right-Sizing my Plans
22: My Own C++ Buffered Sampler on the SAMA5D4
Interlude
23: Building In the Motorized Light Organ
24: Up to the Clouds with Yún
25: Publish or Perish
26: Turntable Finished
Stretch & Boni
Bonus 1a: Remote Light Organ with WiFI pt. 1
Bonus 1b: Remote Light Organ with WiFI pt. 2
Grande Finale: Paho MQTT Client on the SAMA5D4
Related blog
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958
Review 1: Atmel SMART SAMA5D4 Xplained Ultra Unboxing and First Steps
Review 2: Atmel SMART SAMA5D4 Xplained Ultra - Building the Libraries from Source
Review 3: Digital Continuous Rotation (360°) Servo Part 1
Review 4: Digital Continuous Rotation (360°) Servo Part 2
Review 5: Atmel SMART SAMA5D4 Xplained Ultra - TCP/IP running
Review 6: Atmel SMART SAMA5D4 Xplained Ultra - LINUX Distro with SSH support
poem
Enchanted Objects: Let's work together to tame the ATMEL SMART SAMA5D4 Xplained Ultra kit
17 bis: Off South...
Review 7: Atmel SMART SAMA5D4 Xplained Ultra - C++ ADC Example on Linux
Review 8: Atmel SMART SAMA5D4 Xplained Ultra - Product Review
Review 9a: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 1
Review 9b: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 2
Review 10: Atmel SMART SAMA5D4 Xplained Ultra - New Content on AT91.com
1958 Turntable from the Black Forest - Summary of the Enchanted Player Story

I just found this video about the Arduino Yun on a post from doctorcdf on the Internet of Holiday lights

 

 

and another about the RGB lighting shield

 

 

There's also a review of the code examples created during that challenge, thanks to jancumps

 

Compare the Infineon RGB libraries that spawned from the Internet of Holiday Lights

 

and some more about that shield from shabaz

 

RGB LED Shield from Infineon - Getting Started Guide

RGB LED Shield diagrams for documentation purposes

crjeder

About Security

Posted by crjeder Mar 23, 2015

Basic Security Principles

 

From the comments to my first post I've learned that there are different perception of security. Therefore I decided to explain when I call a system to be secure. In general security tries to reach following goals:

 

  • confidentiality
  • integrity
  • availability
  • and sometimes non repudiation

 

What does this mean? For short (longer explanation at Wikipedia):

Confidentiality means that I am able to keep the data secret. As important is integrity - make sure that nobody (else) is able to alter the data. But this is all of limited value if authorized persons can not access the data. Therefore we need to ensure availability. And non repudiation makes sure that we can proof who has sent us that data we are looking at.

One solution to all but availability is cryptography.

 

Cryptograpy

 

In information security a cryptosystem should honour Kerckhoffs's Principle which states:

A cryptosystem should be secure even if everything about the system, except the key, is public knowledge.

This even includes - under some of the attack models - some or all secret messages sent in the past (cf Known-plaintext attack) along with the corresponding encryption. This can even be taken further: the attacker is allowed to craft the messages to be encrypted (cf Chosen-plaintext attack). There are more attack models of which one is of general importance: Brute-force attack. Brute force is always leading to decryption and / or revelation the key. Therefore we have to choose key lengths such that an attacker needs an infeasible amount of resources to do so. A cryptosystem is broken if there exists an attack which performs better than brute force. Even cryptosystems which are broken can be practically secure if  within the time the message should be kept secret the most powerful adversary has a negligible probability of successfully mounting the best available attack.

 

Example:

I want to keep my weather forecast for tomorrow secret. I of course will share the forecast with my family members. The only others who are interested in my weather forecast are my neighbours - all others get more accurate forecast from other sources. So a encryption which takes a usual home computer one year to break with brute force is - for this scenario - practically secure. If I want to encrypt state secrets with the same crypto it most likely won't be considered to be secure.

 

Since in most scenarios adversaries are much more powerful than yourself cryptosystems are designed to be exponentially more difficult to break than to do the encryption. While a 128 bit key is only double the size of a 64 bit key, a brute force attack has to try every one of the 2^128 keys which is 2^64 times the workload as for the 64 bit key! So if do not feel secure enough anymore you double the key size which increases your encryption time by a factor of 2 and increase the time it takes an attacker by the factor of 2^64 ≈ 2*10^20 or 2 times ten billion times ten billion (a 2 followed by 20 zeros). This is the kind of advantage you want!

 

This also rules out a popular strategy by non-security folks: Security trough obscurity.

When taking about security you usually have at least one person asking "What if I do not tell them HOW I did the encryption? That makes the whole brut force thing absolutely impossible since nobody has the code!"

That, of course is not true. Code or hardware implementations can be reverse engineered or observed and with enough knowledge time and patience somebody will come up with the right solution. While this is a lot more complicated than just using an available implementation and start right away with brute forcing, it also makes YOR life much more complicated. I. e. you never know how much harder breaking your "crypto" is than en- / decoding and thus how much time you got until your secret is known. For proper cryptograpy it is just simple math as shown above.

 

That been said I do not get why Atmel puts its secure boot documentation under NDA.

I have done the first trials with the SAMA5D4 Xplained Ultra. My progress is limited:

I can connect to the board via a terminal program and execute some linux commands.

 

I haven't been able to get the SAM-BA utility working and failed to get a dev environment installed on my pc.

 

 

 

 

xplainedultrafirstlife.jpg

 

 

 

Atmel Studio 6.X and me

Atmel Studio and myself had a fight.  My favorite search term last week-end was "visual studio invalid license data. reinstall is required".

 

I installed V6.1. I had a few hickups but succeeded in installing it.

Every time I started it, it tried to set up some Help utility for Atmel boards, that consistently failed (I ran the program as normal user and with elevated rights to see if that made a difference: no.

 

I installed all upgrades. I haven't been successful in finding a project for the SAMA5D4 or for this Xplained Ultra board.

 

But the install had a side effect. The software for my HP printer/scanner stopped working. When I tried to start the scanner, I got this message:

scannererror.PNG

The web is full of people that have similar issues with other programs after installing a development environment based on the VS2010 framework. The issue is so known! Unfortunately, the resolution isn't.

 

Uninstalling Visual Studio from the Control Panel resolved the license issue.

 

I tried to outsmart the system and install the 6.2 beta of Atmel Studio. That didn't make any change. The Xtreme Ultra is still not a known board, and the license issue reappeared.

 

So current status is: no Atmel Studio installed.

 

I hope to learn from the experiences of my fellow participants here.

Andy Clark (Workshopshed)

Superclock

Posted by Andy Clark (Workshopshed) Top Member Mar 23, 2015

Looks like we're not the only people making enchanted objects

 

http://www.superclock.info/

 

"We are building a clock for your home, connected to the internet.
The sphere shows you when the next bus is coming."

 

?format=500w

The way things were

Matilda'a father had worked his life in the coal mine so she was no stranger to a bit of hard labour. As a child she'd played at being a miner, smashing rocks in the back yard of their terraced house with a small hammer.

 

Today she had a much bigger hammer. She'd already supported up the archways with props and removed the old fashioned glass thermometer, so it was just a case of removing the front wall. A bit of persuasion with a sledge hammer and the front wall was turned to a pile of rubble. As she stared at the burnt out shell of a house she thought back to how it was when they first moved into their woodland cottage.

 

The cottage was a strange design with two arches at the front. A long beam spanned the house and pivoted in the middle. The beam was linked to a twisted shank of cord made from "cat gut" although they had been assured that no cats had been harmed in it's making. The cord had a strange property and acted as a simple hygrometer, when the air was damp the cord loosened and unwound moving the beam but when it was dry it twisted back up and moved the beam in the opposite direction.

 

Matilda had never liked that beam, it moved her in an arc and meant that there needed to be a large gap in the front wall.

 

 

A new beginning

Hans sketched out a rough schematic of the new control system, the power to the cottage was erratic so they did not want to rely on a main supply, the YUN did not have a regulator so Hans knew he was going to need some kind of circuitry for that and perhaps it would be good to charge the battery when there was power available. "Perhaps we could put some solar panels on the roof", he thought out loud. "One step at a time" suggested Matilda and Hans agreed.

 

BasicSchematic.png

A visit to the Town Faire

After her exertion, Matilda took a well deserved break and went with Hans to visit the town faire. Between the stalls and rides Matilda spotted something from her childhood. The town historical society had restored one of the old locomotives that pulled the coal wagons. She marvelled at how it's linkages converted the linear motion of the pistons into rotary motion for the wheel. When she got home she sketched out a mechanism for connecting up the servo to the movement in and out of the house.

Mechanical.png

Next Enchanted Objects Design Challenge - Matilda is not happy

Hi everyone

 

So my proposal for an enchanted objects is a Mirror, but just not an ordinary one...

 

The intention is to produce a marriage of an Infinity Mirror, a 23" ish LCD panel and a series of sensors and internet connected IOT feeds both providing and using the cloud to provide local weather on the mirror as well as possibly reminders, a video feed of people coming to the front door so you can see before you open it and of course the LEDs of the infinity mirror can adjust colours based on the weather, orange for warm, blue for cold, red for blistering hot, and other effects for Rain etc. Time permitting I will also be adding to the scope of the Mirror by having it interact with other household objects, but ill keep that a surprise

 

It will be having sensors inside the house and outside in order to detect the required events and if I am able to figure out a few things, perhaps facial recognition or voice so that you can ask questions of a few topics

 

Now this initial post is regarding a proof of concept to see if the approach im using will work for the infinity mirror before I commit the LCD and other much more expensive items to the tools

 

The Mirror film I have is from Home Depot here in Canada

http://www.homedepot.ca/product/mirrored-privacy-window-film-3-feet-x-15-feet/919621

and is intended for use with Glass, not Plexy or Acrylic so I need to now if it will work. Also an infinity mirror normally has a full back mirror and a two way front mirror, I need to use two 2 way mirrors as the LCD will be behind the mirror and need to shine through when displays are needed

 

Here is how an Infinity Mirror is supposed to work, the observer looking toward the darker side will see a reflection of themselves and the emitted LED light, in this case there will also be the light from the LCD panel

Mine will be 50% on the back too as I need to have an LCD screen behind it

 

I have produced this intro video that also demonstrates a proof of concept for the infinity mirror

 

20150322.jpg

 

I've completely cleaned and lubed the drive unit of the Perpetuum-Ebner. All old grease and oil has been removed with isopropyl alcohol (we call it isopropanol down here).

All parts that needed some grease or oil have been serviced. The table is spinning very smoothly at my desk right now,

powered by a motor from an old video recorder.

 

Photo 22-03-15 19 01 30.jpg Photo 22-03-15 19 01 43.jpg Photo 22-03-15 19 32 23.jpg

Photo 22-03-15 20 16 59.jpg

Photo 22-03-15 20 33 22.jpg

 

With that in place, it's now time to start working on the motor control. She's going to be driven by the Infineon DC Motor Control Shield for Arduino.

I've given the shield a make-over to make it stack better on top of the Arduino, and to get it fitted inside the table.

Photo 22-03-15 20 48 50.jpg

The revamped shield has stacking headers, and the (very nice Vishay) cap has been replaced by one that doesn't take that much vertical real estate.

I've fitted screws with a very flat head to avoid that they contact the connectors of the Arduino UNO.

 

With all these things in place I can start with the first Enchanted electronics.

The rotation of a 60 year old appliance is going to be controlled by that Infineon shield and the new millennium's Arduino.

 

Pre-work

 

Here is the story about my prototype of the motor control concept:

Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958 - part 3 - Infineon Motor Driver shield

Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958 - part 4 - Hercules LaunchPad Enhanced PWM try-out

 

 

Table of Contents
Chapter 1: Fix the turntable
1: Perpetuum Ebner Musical 1
2: A Time to Kill and a Time to Heal
3: Preparation for Motor Drive
4: Motor control with Infineon Motor Shield and Arduino UNO
5: Turntable speed sample testbed with Arduino UNO
6: Turntable Speed Sensor design
7: Control Theory - End of Chapter 1
Chapter 2: First Enchantments
8: Digital Light Organ Enchantment
9: Autonomous Servo Lift
10: SMD Time - Solder the IR Speed Sensor PCB
11: Yelp - who can Help me to Compile and Run my First SAMA5D4 C Program
12: Son et Lumiere - End of Chapter 2
Chapter 3: Taming the Board
13: Breakthrough - Run my own C++ Program on the SAMA5D4
14: Digital Light Organ Input Buffer
15: SAMA5D4 Blinky
16: Scope Creep
17: Audio Sampling with 16-bit ADC ADS8343
18: Sending Files to SAMA5D4 over USB
19: Port my Light Organ from Arduino to SAMA5D4
20: Fast Fourier Transform on the SAMA5D4 - End of Chapter 3
Epilogue: Reaching for the Clouds
21: Right-Sizing my Plans
22: My Own C++ Buffered Sampler on the SAMA5D4
Interlude
23: Building In the Motorized Light Organ
24: Up to the Clouds with Yún
25: Publish or Perish
26: Turntable Finished
Stretch & Boni
Bonus 1a: Remote Light Organ with WiFI pt. 1
Bonus 1b: Remote Light Organ with WiFI pt. 2
Grande Finale: Paho MQTT Client on the SAMA5D4
Related blog
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958
Review 1: Atmel SMART SAMA5D4 Xplained Ultra Unboxing and First Steps
Review 2: Atmel SMART SAMA5D4 Xplained Ultra - Building the Libraries from Source
Review 3: Digital Continuous Rotation (360°) Servo Part 1
Review 4: Digital Continuous Rotation (360°) Servo Part 2
Review 5: Atmel SMART SAMA5D4 Xplained Ultra - TCP/IP running
Review 6: Atmel SMART SAMA5D4 Xplained Ultra - LINUX Distro with SSH support
poem
Enchanted Objects: Let's work together to tame the ATMEL SMART SAMA5D4 Xplained Ultra kit
17 bis: Off South...
Review 7: Atmel SMART SAMA5D4 Xplained Ultra - C++ ADC Example on Linux
Review 8: Atmel SMART SAMA5D4 Xplained Ultra - Product Review
Review 9a: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 1
Review 9b: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 2
Review 10: Atmel SMART SAMA5D4 Xplained Ultra - New Content on AT91.com
1958 Turntable from the Black Forest - Summary of the Enchanted Player Story

This week we received a welcoming parcel from Element14!! The parcel contained, Atmel SAMA5D4 Xplained Ultra, Arduino RGB LED Lighting Shield, Arduino DC Motor Control Shield  and the Arduino Workshop Livello Kit. We are still waiting for a couple of items but this is a great start, nothing will be holding us up.

 

I have started on making the clock. I am using plans purchased from Clayton Boyer Clock Designs ("The Simplicity"), I have had them for years now. This will be quite a project as there are many gears to produce.

 

Gears.jpg

 

Above are just the start of some of the gears required. I am using 1/4" and 1/2" Baltic Birch for most parts, the rest will be made from solid wood.

Below is a picture of the clock that I am building (Completed - The picture is from the internet (I didn't build this) it's to give you the idea of how it will look when complete)

 

Finclock.jpg

 

I have purchased an Arduino shield for voice recognition to integrate speech into our project. I have been working on code for this part, still in the early stages. Start with lots of testing.

Right now I am just taking a break from working with the SAMA5D4 and getting this all figured out how it will come together.

Chrystal is sick right now and hasn't helped with the project yet. She is looking very forward to submitting some of the Blogs and letting everyone know what she has been doing.

 

Thank you all so much,

 

Chrystal and Dale Winhold

Following pettitda instructions  Atmel SAMA5D4 Xplained Ultra Road Test -- Day 3

I installed the USB driver, and hooked my SAM to the USB of a windows machine, connected with putty....and... hello there!

Note that I did not have to change flow control to "none", just changed speed to 115200 and set correct port.

"root" account is without password. Had a look around, by running:

uname -a

Linux sama5d4-xplained 3.10.0-custom #1 Thu Oct 30 16:04:45 CST 2014 armv7l GNU/

cat /etc/issue

    Poky (Yocto Project Reference Distro) 1.6.1

cat /proc/version

    Linux version 3.10.0-custom (josh@melon) (gcc version 4.8.2 (GCC) ) #1 Thu Oct 30 16:04:45 CST 2014

df -h

Filesystem      Size  Used Avail Use% Mounted on

rootfs          446M  100M  347M  23% /

ubi0:rootfs    446M  100M  347M  23% /

devtmpfs        251M    0  251M  0% /dev

tmpfs          251M  72K  251M  1% /run

tmpfs          251M  108K  251M  1% /var/volatile

 

top

top - 09:14:38 up 51 min,  1 user,  load average: 0.08, 0.03, 0.05

Tasks:  39 total,  1 running,  38 sleeping,  0 stopped,  0 zombie

Cpu(s):  0.3%us,  0.3%sy,  0.0%ni, 98.7%id,  0.0%wa,  0.0%hi,  0.7%si,  0.0%st

Mem:    513976k total,    25240k used,  488736k free,        0k buffers

Swap:        0k total,        0k used,        0k free,    11776k cached

 

opkg list|grep java

    but got nothing back

 

Did a quick search, and came up with this:

https://software.intel.com/en-us/blogs/2014/04/04/some-hints-on-yocto-builds-for-iot-devkit-example-adding-java-jre

It's for Intel(R) Galileo board, but it's also using Yocto. This gave me a hint, that I need to specify a source url for /etc/opkg/opkg.conf but is there one that we could use ?


So I guess that means, I will have to install Java manually, or the normal (atmel) approach must be to build a different image with the distro of choice (i.e. debian) and inherit the support/repos/etc.

As a quick and dirty test, I tried the following:

wget http://ftp.heanet.ie/mirrors/funtoo/distfiles/oracle-java/jdk-7u60-linux-arm-vfp-hflt.tar.gz

                          (Oracle requires "I agree" ticks, so I did a search and found a random mirror for direct download)

mkdir /java

tar xzf jdk-7u60-linux-arm-vfp-hflt.tar.gz

export JAVA_HOME=/java/jdk1.7.0_60/jre/

java -version


     java version "1.7.0_60"

     Java(TM) SE Runtime Environment (build 1.7.0_60-b19)

     Java HotSpot(TM) Client VM (build 24.60-b09, mixed mode)

 

..that went smooth

 

Next post >> [ExM] #3 First attempt on Arduino Yun

Planned obsolescence is one of the biggest problems in today's technological products. Things get rotten, dusty, forgotten and lost of their initial use, becoming part of a pile of not good enough's even before they are meant to be like that. However, old stuff like mechanisms from the 60's still work, brilliantly in some cases! And yet, they have been replaced with better, more useful but less durable devices.

antique_backspace_key_sjpg1572.jpg

That is why this challenge is so great, giving life back to those things that hold that special spirit of durability and easiness to open, repair and hack. One can even argue that the brand new open software and hardware movement is just trying to bring this back.

 

But enough with the nostalgia and positivism, lets get to the point.

 

The-Chromatic-Typewriter-by-Tyree-Callahan.jpg

 

 

My cousin Patricia, which is an art student, told me some months ago about a project made by an American artist that took an old typewriter and seemed to print paintings. What a wonderful idea! However, that was just a concept, a photographic montage with human generated paintings, not a working model. My cousin really knows me well, I immediately said to her:


- This needs to be done by someone.

- Let's do it ourselves them! - she said.

 

And that's how I easily got invested in this idea. Yet, we had no typewriter nor electronics that would be up for the challenge. Then, a few weeks after, I found a lovely typewriter besides the trash of my street. Just like a crazy man with Diogenes syndrome I ran for it and took it to my cave! And a bit afterwards, the Enchanted Objects Challenge showed up and boy, wasn't that an amazing coincidence!

 

It might not be the most complex electronics development project, but it's certainly a mechanical challenge and a nice application of the Internet of things framework. For starters, we are just going to make sure that we can make a feasible mechanism for the painting system, firstly trying with small compartments of paint and sponges attached to the tips of the type hammers. Then, we'll try to use servos to pull the keys. And lastly, the electronics and communication with server.

 

Next week I'll post the full description of the design process and a flowchart explaining it.

 

See you next week!

 

Tana.

20150321.jpg

 

57 years old grease

 

Like all mechanical devices, this turntable needs servicing. And it hasn't had any since it left the Black Forest.

I've taken the whole drive unit apart. Every part is going to get cleaned and every bit if old grease, gunk and oil will have to go.

I'm carefully checking what parts have been greased or oiled, because I should only apply new lubricants where needed.

Only one thing is worse than a badly greased turntable: one that has lube on parts that should be left clean.

 

IMG_4277.JPG

I'm using two lubricants. A tube of automotive grease, SKF VKG 1/0.2 lithium, and fine white technical oil made by the Belgian company Vic Van Rompuy.

There are different opinions on the internets on what is the right product to lubricate these things.

For my own mental health, I'm ignoring the different powers that be, and I stick with these two products.

IMG_4279.JPG

 

Once that's done, I can rebuild the drive mechanism and put it back in place. That's also a good time to start with the speed measurement mechanism.

I've built a prototype between the announcement of this contest and my selection (Make Speed Sensor from Scrap Parts and Sample the Motor Speed with Microcontroller).

I'm now going to make a proper fixture that can survive some shocks and abuse.

Photo 21-03-15 15 15 57.jpg

 

What you see on the bottom of this photo is an IR transmitter and receiver.

They are going to detect each rotation of the tapped pulley that you see in the upper right corner.

I've painted the bottom side of that pulley with a Sharpie. That part of the pulley will not reflect the IR beam.

In the middle of the photo you see a small mirror. That's going to be glued on the bottom of the pulley.

Only when that mirror is above the detector, the beam is reflected and we'll get a signal out of our IR receiver.

And that will happen just one time per rotation.

 

What's happening with the Arduino Kit?

 

I've given it to one of my kids. She's going to work through the workshops. She promised to take photos and videos along the way.

Here's the first activity: Button State Change Detection (Edge Detection)

 

 

2015-03-21 10.44.00 1.jpg

 

 

 

Make some room

 

I'll need some room in the cabinet to place the electronic parts.

For that, I've removed all possible components that will not be used in the enchanted version of the turntable.

I store them away safely, so that the Perpetuum can be restored in its original state at a later time.

 

BeforeAfter
Photo 21-03-15 13 58 43.jpgPhoto 21-03-15 14 07 45.jpg

 

Side story: Perpetuum Ebner

 

The Black Forest has an age old reputation for making the best and the finest automatons. You can argue over the style (remember the cuckoo clock?). But you can't argue over skills and craftsmanship. They were the masters of the automaton.


That is also where the roots lie of our Perpetuum-Ebner.  At the turn of the previous century, a Mr. Christian Steidinger started a small workshop in St. Georgen im Schwarzwald. Like so many other entrepreneurs of that area, he started with crafting parts for clocks.  His brother Josef started his own workshop at the same time, in the same village. A few years later they joined forces and grounded a company together.


But the peace in the family wouldn't last long...

 

 

Table of Contents
Chapter 1: Fix the turntable
1: Perpetuum Ebner Musical 1
2: A Time to Kill and a Time to Heal
3: Preparation for Motor Drive
4: Motor control with Infineon Motor Shield and Arduino UNO
5: Turntable speed sample testbed with Arduino UNO
6: Turntable Speed Sensor design
7: Control Theory - End of Chapter 1
Chapter 2: First Enchantments
8: Digital Light Organ Enchantment
9: Autonomous Servo Lift
10: SMD Time - Solder the IR Speed Sensor PCB
11: Yelp - who can Help me to Compile and Run my First SAMA5D4 C Program
12: Son et Lumiere - End of Chapter 2
Chapter 3: Taming the Board
13: Breakthrough - Run my own C++ Program on the SAMA5D4
14: Digital Light Organ Input Buffer
15: SAMA5D4 Blinky
16: Scope Creep
17: Audio Sampling with 16-bit ADC ADS8343
18: Sending Files to SAMA5D4 over USB
19: Port my Light Organ from Arduino to SAMA5D4
20: Fast Fourier Transform on the SAMA5D4 - End of Chapter 3
Epilogue: Reaching for the Clouds
21: Right-Sizing my Plans
22: My Own C++ Buffered Sampler on the SAMA5D4
Interlude
23: Building In the Motorized Light Organ
24: Up to the Clouds with Yún
25: Publish or Perish
26: Turntable Finished
Stretch & Boni
Bonus 1a: Remote Light Organ with WiFI pt. 1
Bonus 1b: Remote Light Organ with WiFI pt. 2
Grande Finale: Paho MQTT Client on the SAMA5D4
Related blog
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958
Review 1: Atmel SMART SAMA5D4 Xplained Ultra Unboxing and First Steps
Review 2: Atmel SMART SAMA5D4 Xplained Ultra - Building the Libraries from Source
Review 3: Digital Continuous Rotation (360°) Servo Part 1
Review 4: Digital Continuous Rotation (360°) Servo Part 2
Review 5: Atmel SMART SAMA5D4 Xplained Ultra - TCP/IP running
Review 6: Atmel SMART SAMA5D4 Xplained Ultra - LINUX Distro with SSH support
poem
Enchanted Objects: Let's work together to tame the ATMEL SMART SAMA5D4 Xplained Ultra kit
17 bis: Off South...
Review 7: Atmel SMART SAMA5D4 Xplained Ultra - C++ ADC Example on Linux
Review 8: Atmel SMART SAMA5D4 Xplained Ultra - Product Review
Review 9a: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 1
Review 9b: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 2
Review 10: Atmel SMART SAMA5D4 Xplained Ultra - New Content on AT91.com
1958 Turntable from the Black Forest - Summary of the Enchanted Player Story

Project background

I am a (software) engineer and an espresso coffee enthusiast. As a result, I could not settle for an ordinary instant capsule coffee with hightech chemistry but without real smell and taste of proper coffee (i.e speciality coffee). So I got myself an  old school professional espresso coffee machine, revived it and I am enjoying quality coffee at home... well kind of. These old heat exchange espresso machines, require expert handling, to produce decent coffee. It's not like you press a button, and magic happens. You need to warm it up for 30+ minutes, and then heat flush (throw away some hot water) to bring it to perfect temperature (somewhere between 90 - 94C) so you can brew your espresso. In addition to water temperature, the volume of water and brew time have a major effect on the end result taste. As if this wasn't enough, one should also consider grind setting combined the amount of coffee per shot, (and freshness of beans, and room humidity :-P)


I guess that's why most people prefer ready-to-use coffee capsules, but sometimes I like the long way home :-)


As a home-barista I am constantly trying to improve my skill, and resulted coffee. This requires attention to details so that I can reproduce the same result. It would have been so much easier if I could see all brewing related values, store logs among with comments on the coffee taste, so I can study them later, and improve/reproduce the best results. Therefore it is now time for my old espresso machine to get an upgrade to the IoT world !


Introducing Espresso ex Machina!


Espresso ex Machina.jpg



Core objectives, espresso machine mod: (in blue color)

  • add temperature sensors (need to decide between thermocouples, thermistors, ICs etc)
  • PID control of heating element via SSR using Arduino SAMA5D4
  • connect water flow sensor, to Arduino (and calibrate). This is needed to keep track of water volume in produced coffee.
    • old/original  sensor already deployed. I am assuming it's an open collector output, but will find out more
  • add one or two RGB led stripes to give some “life” to the machine using the Infineon Lighting RGB LED Arduino Shield. Will try the “breath in/out” effect, and use color to describe if boiler is ready/worm (takes about 30 minutes)
  • Connect a speaker to SAMA5D4 and run a “text to speech” application for reading out loud temperature values, and other coffee related information.
    • Will also try some “speech to text” (e.g. trigger readings on word “coffee”). This could be possible with android on SAMA5D4 but I will experiment first with yocto/linux and openhab
  • log and submit all readings (temp, timestamp, duration, volume) to a cloud service (e.g. Xively, thingspeak) via http or mqtt
  • tag readings somehow with my  “coffee taste review”  (could be via the machine again, and a 5 star rating via keyboard, or via smartphone using some basic app)


I guess the above could be accomplished on Arduino Yun , but to play with text to speech (and my favourite OpenHAB) I will be using SAMA5D4.


Extra objectives if time permits: (in pink)

  • Add Arduino Yun to log and submit grinding duration, hence estimate of coffee grams, but I need to find a way to read grinding settings automatically. (?)
  • add a pressure sensor, to log actual water pressure as well
  • control rotary pump speed, to adjust pressure, hence do “pressure profiling” which makes a big difference in espresso taste.
    • need to replace the AC motor, with a DC equivalent, and use the Infineon DC Motor Control Shield for Arduino
    • alternative lame approach, keep AC motor, add an adjustable Voltage Regulator. Connect servo on the potentiometer, use Infineon shield to control servo, to control voltage regulator, to control AC motor :-P


Any ideas on how to tackle these issues, easy, quick and cheap, are more than welcome.


Next >> [ExM] #2 First attempt on the Atmel SAMA5D4, installing JAVA


First of all I want to thanks element14 and sponsors for selecting me as competitor in this awesome competition.

Here I want to share some ideas about my project enchanted windows.

 

 

 

1) It can be opened or closed remotely from anywhere. All the windows and curtains in our house can be closed by a single button in our mobile app, when we are leaving from home. Also we can know status (open or close) of any window.

 

 

 

2) It can we used as morning alarm. Windows and curtains will be opened automatically in morning and let the sun come in at preset time.

 

 

 

3) It can be used to avoid the mosquitoes and other unwanted bugs which generally enter home in evening time. We can set the time so that some desired windows will be automatically closed in evening at that time.

 

 

Not only preventing them from coming in we can add functionality to even kill them

Implementation

We can use high voltage grid and put it before window on outside. Generally insects are attracted towards the light. So we can have a light source behind window. Insects will be attracted toward the light but will be killed due to high voltage grid. Again this can be enabled using any wi-fi device. Arduino uno will control a relay and light source.

mosgito.PNG

 

 

 

4) We can avoid fire accidents due to gas leakage by having automated ventilation, using gas sensors. If a gas sensor detects gas leakage the windows near leakage will be opened automatically, so that gas can be released outside easily.

 

 

 

5) Sometime in India people use diesel generators inside home this can create suffocation to the people and even lead to death. We can check CO2 level in home, and when it goes above the certain level windows will be opened automatically. Also In this condition people can cannot clearly find exits .So we can use red lights to show exits.

 

 

6) For the people who leave near railway station & airport are generally irritated by loud noise. We can automate windows, so that when noise begins it will automatically close and opens when noise goes.

rpbruiser

Wish One Was Granted

Posted by rpbruiser Mar 19, 2015

As I sit at my desk, alone in the dark, I remember wishing that there was someway I could make my dream of a magical lamp, that fulfilled all my wildest dreams a reality, rather than just another picture on a piece of paper somewhere in the landfill. Well apparently I had rubbed my lamp because just like that


                                                  *POOF*


image1.JPG



my magic genie was there! My wish came true! I had everything I would ever possibly need to make my idea, for all to have there own special genie lamp, come to fruition. I would like to thank all the "genies" that made this possibly! (Also I apologize for the mess, you know, genies create quite the gush of wind when they come out of that lamp so fast!).

There was a knock at the door and a from behind a pile of parcels, a muffled voice said, "delivery for the enchanted cottage".

"That's us" said Hans and Matilda simultaneously. All of the components except for the Yun had arrived safely, "what's in the box from CPC" asked Matilda? "Oh that", said Hans, "that's a sellotape holder, I ordered before Christmas which was out of stock".

parcels~2.jpg

A big thanks to Christian, Joseph and everyone at Element14 and Atmel who have been involved in setting up the Design Challenge, I can tell a lot of effort has gone into it. I'm really excited about this challenge.

crjeder

Fairy Dust has arrived!

Posted by crjeder Mar 19, 2015

Today in the mail I found a parcel by Farnell - The Fairy Dust has arrived!

DSC_9101.JPG

Also in the mail: The first of the items I ordered for the competition:

DSC_9103.JPG

RGB LEDs with integrated controller.

 

Now I take the first challenge of the competition: Install Linux on the SAMA5D4.. from what I've red in the RoadTest this won't be easy!

amgalbu

MagicHat - 01 - Introduction

Posted by amgalbu Top Member Mar 19, 2015

 

One of the most difficult tasks for a doctor is to divert a child attention while trying to make an injection. And what's better than something magic to entertain a child?

 

So for this challenge I thought of building a magic hat.

 

The magic hat will be able to read a child's mind. Under the hood (literally) there will be an health diagnosis system capable of measuring body temperature, heart rate and blood pressure.

 

To add something real magic, the magic hat will speak, recognize speech and move

 

Here is an image that gives an idea of what I'd like to achieve in this challenge

 

01 - Harry.png

 

 

 

The magic hat will be made up the following components

 

1. a Arduino Yun board: the core of the magic hat

 

2. a USB sound interface

 

3. a servo control to make the hat bend

 

4. a IR thermal sensor, like the MLX90614. Melexis' MLX90614ESF-BAA is an infrared thermometer designed for non-contact temperature sensing. An internal 17-bit ADC and a powerful DSP contribute to the MLX90614’s high accuracy and resolution. It has a huge number of applications including body temperature measurment and movement detection.

 

5. a blood pressure sensor. This is something experimental I'd like to try... I will start from a photoplethysmographic sensor and build an apparatus for measuring blood pressure using a finger cuff

 

6. an accelerometer: the accelerometer will detect if magic hat is being carried

 

7. a LED bar to simulate the mouth movements

 

8. a battery pack to power everything up. Since the Arduino Yun is powered through a micro USB, I will likely use a smartphone powerpack

 

Here is how the components will be connected

 

01 - Overview.png

 

 

The flow of the whole application is shown in this flowchart

 

01 - Flowchart.png

 

 

 

 

 

It turns out that element14 is not the only place where people are talking about making ordinary, or obsolete, objects extraordinary, enchanted objects.

(Hint: Take a look at our Enchanted Objects Design Challenge and what our challengers are promising.)


There's a new, free app in town from Camio, a new business.  It magically makes old Android or iphones into Internet friendly surveillance cameras.


Image result for old smartphones


This is one of many new persectives on the Internet of Things. This app doesn't incorporate sensors into the things/objects/appliances that are around us to track data.


It uses an obsolete object to understand the events taking place in a certain location. If you have an account, you can watch the video that the app stores from anywhere.


Maybe you want to know what your pets are doing, where you parked your car or do a study on your own habits;)

 

Have you tried it out? Does it interest you? We want to know.

Chrystal and I would like to thank all the sponsors, Element14 and everyone involved for choosing us to compete in this challenge.

 

Our enchanted clock is going to be very special. The clock is going to be hand made by Chrystal and myself, all made from wood (recycled wood). All the working parts are going to be made from wood as well (Gears, hands, weights etc.) I am a cabinetmaker by trade and need a new challenge so building a wooden clock fit right into this challenge perfectly.

 

The clock will be enchanted beyond imagination, this will include:

  • A humidity regulator for the clock - Wood clocks only work for around 9 months a year due to the seasons cause the wood to move. Since the gears are hand fitted and made of wood, when the wood expands and contracts with humidity it causes the clock to stop. With a humidity regulator it will keep this from happening.
  • Wood clocks usually lose or gain time due to imperfections -This will be corrected twice a day automatically
  • You can't have an enchanted clock without voice control - To dark to see the time? Just ask -  A little cold in the room? Ask the clock to turn up the temperature - Need lights on? Just ask... oops, dad's sleeping, the clock will only turn the lights on dim as not to wake him.
  • The clock will know if no one is in the room and turn the lights off to save energy.
  • Forgot to wind the weights? Don't worry it will be done for you.
  • Need to check on the house while away? Check your phone and ask the clock for information (Encrypted of coarse)

 

Below is a flow chart of the way this will work:

 


Clock flow.jpg

 

 

About us:

 

Chrystal is my 14 year old daughter and loves to be a part of my projects. She knows some programming and is very artistic. Her greatest passion is the environment and school. My wife and son (12) are the moral support and give ideas a well as encouragement. I am a cabinetmaker (28 years) and also do network security testing and programming (strange combination). An industrial accident 4 years ago limited my cabinetmaking a bit but I still love my job (I have to say, I am paid for my hobby, it can't get better then that!!)

 

Thank you again,

Chrystal and Dale

 

Any questions, comments or ideas please ask!!

20150317.jpg

 

I own a defunct turntable from the fifties...

 

I started the story with a lie. I don't own it. It's not mine. It happens to be in my mansion but it belongs to someone else.

It's a Perpetuum Ebner Musical 1. If you are into beautiful designed products, you'll like the looks:

 

IMG_4135.JPG

 

And I'm going all medieval on that machine that's not mine. It is currently in non-working condition. It must have been in a non-working state for tens of years.

And I'm not making it any better:

IMG_4182_pmpd.JPG

At the moment it's more a doomed object than an enchanted one. I took the action picture above a few minutes ago. It's in a dire state of decomposition at the moment.

But I have wild plans

 

The plan

 

I'm going to fix it! And I'm going to enchant it straight into the 21st century.

I have good hopes on bringing it back to live (I couldn't wait for this challenge to start so I have been prototyping a fix). And then all options are open.

I've been thinking about making it a home audio wifi streamer. I'd like to use a Shazam-like service that recognizes the song that's playing.

I'd like to post stats on the cloud. I'd like it to be able to decode those satanic backwards played messages that were hot in the 70's Rock scene.

I'd like to ...

 

Failure is an option

 

Of all the things on the bucket list above, I have the skills to complete one: fixing it.

For all  the other ideas I don't have the skills. I don't know if the supplied parts are up to the job. I just don't know anything.

So you can find out together with me if this story has a happy end.

 

 

Side story: Perpetuum Ebner

 

The history of the Perpretuum-Ebner company from the German Black Forest reads like a fairy tale by itself.

It's a story of families breaking up, brothers starting a competing factory in the same village, deception, family raws and tactical marriages.

And its setting in the vast and mysterious Black Forest makes it even more daunting.


We'll try to unravel all secrets and conspiracies in this blog...

 

 

Table of Contents
Chapter 1: Fix the turntable
1: Perpetuum Ebner Musical 1
2: A Time to Kill and a Time to Heal
3: Preparation for Motor Drive
4: Motor control with Infineon Motor Shield and Arduino UNO
5: Turntable speed sample testbed with Arduino UNO
6: Turntable Speed Sensor design
7: Control Theory - End of Chapter 1
Chapter 2: First Enchantments
8: Digital Light Organ Enchantment
9: Autonomous Servo Lift
10: SMD Time - Solder the IR Speed Sensor PCB
11: Yelp - who can Help me to Compile and Run my First SAMA5D4 C Program
12: Son et Lumiere - End of Chapter 2
Chapter 3: Taming the Board
13: Breakthrough - Run my own C++ Program on the SAMA5D4
14: Digital Light Organ Input Buffer
15: SAMA5D4 Blinky
16: Scope Creep
17: Audio Sampling with 16-bit ADC ADS8343
18: Sending Files to SAMA5D4 over USB
19: Port my Light Organ from Arduino to SAMA5D4
20: Fast Fourier Transform on the SAMA5D4 - End of Chapter 3
Epilogue: Reaching for the Clouds
21: Right-Sizing my Plans
22: My Own C++ Buffered Sampler on the SAMA5D4
Interlude
23: Building In the Motorized Light Organ
24: Up to the Clouds with Yún
25: Publish or Perish
26: Turntable Finished
Stretch & Boni
Bonus 1a: Remote Light Organ with WiFI pt. 1
Bonus 1b: Remote Light Organ with WiFI pt. 2
Grande Finale: Paho MQTT Client on the SAMA5D4
Related blog
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958
Review 1: Atmel SMART SAMA5D4 Xplained Ultra Unboxing and First Steps
Review 2: Atmel SMART SAMA5D4 Xplained Ultra - Building the Libraries from Source
Review 3: Digital Continuous Rotation (360°) Servo Part 1
Review 4: Digital Continuous Rotation (360°) Servo Part 2
Review 5: Atmel SMART SAMA5D4 Xplained Ultra - TCP/IP running
Review 6: Atmel SMART SAMA5D4 Xplained Ultra - LINUX Distro with SSH support
poem
Enchanted Objects: Let's work together to tame the ATMEL SMART SAMA5D4 Xplained Ultra kit
17 bis: Off South...
Review 7: Atmel SMART SAMA5D4 Xplained Ultra - C++ ADC Example on Linux
Review 8: Atmel SMART SAMA5D4 Xplained Ultra - Product Review
Review 9a: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 1
Review 9b: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 2
Review 10: Atmel SMART SAMA5D4 Xplained Ultra - New Content on AT91.com
1958 Turntable from the Black Forest - Summary of the Enchanted Player Story
iayanpahwa

My Wardrobe Enchants :D

Posted by iayanpahwa Mar 17, 2015

Introduction:

 

Thank you element14 community, organizers, sponsors for selecting my project making it eligible for "Enchanted Objects" design challenge, enabling me to test my skills and knowledge to convert everyday dumb objects in smart enchanted objects. This is my very first design challenge and I wish to make each blog post count specially focusing on the people who would like to replicate my projects for their personal use or improve them with their creativity. So lets get started.

 

My project is sub-divided into small modules each aims to convert dumb everyday object present in our houses into a smart device capable of easing your life giving you a feel of connected home and a bit of tony stark laboratory(kidding). This post is meant to introduce you to the very first module i'll be working on and its called Enchanted Wardrobe.

 

 

It might sound science fiction by now but now its possible to make your wardrobe suggests clothes or OUTFIT OF THE DAY for you. HOW? Thanks to Enchanted Wardrobe in your house. But how does it actually works?


Answer lies in weather:

 

GOOD Morning Human: ITS SEEMS A BRIGHT SUNNY DAY, HOW ABOUT PICKING LIGHT COLOR COTTON TODAY? DON'T FORGET YOUR SHADES.

 

HEY HUMAN SEEMS LIKE ITS GOING TO RAIN TODAY, DONT FORGET UMBRELLA/RAIN COAT AND BOOTS.

 

HEY HUMAN SEEMS CHILLY WEATHER TODAY, WOOL WILL WORK JUST FINE #WIN


 

For version-1 these messages can be displayed on and RGB LCD, if success I may implement a Text to speech based system.

 

We can also think of bringing these clothes forward if acknowledged by the user, provided the clothes are arranged properly.(IDEA!)

That's how a normal everyday object lying in our room, we use daily can be converted to a smart enchanted objects.


INTRO.JPG


crjeder

Smart Key Hooks - Prelude

Posted by crjeder Mar 16, 2015

Introduction

 

I would like to thank the organizers and sponsors of this challenge and for giving me the chance to take part and learn.

This is my first challenge and will be my first major programming project in at least 10 years and my first electronic design in more than 20 years. So please be patient with me, I might have a rather slow start.

So why is such a total noob as I am entering such a challenge?

In the detailed description for the challenge Pat Kelly writes:

 

„element14 believes that the Internet of Things may hit a roadblock: namely, the lack of secure communications between objects and individuals could lead to a situation in which data is being shared without explicit consent and exploited for malicious purposes.“

 

I totally second that. And I am amazed that anybody thinks „security first“ because the world already is full of devices and gadgets which are shipped with the functionality barely in place and no security at all. And this is even the best case – many corporations try to gather as much data about us as possible. New products and services seem to be launched only for that purpose.

Therefore I will use my 15+ year experience in security to see what I can do about this problem.

 

Project Idea

 

Our Key Hooks looks like this:

DSC_9100.jpg

As you can see it is not only used to store the keys, but it also serves as a message board. Since every household member has an own keyring and would not leave home without it one can determine who's at home by looking at board. Hanging the key would be one of the first thing one does when back home. If you look closer you can see a few key rings with only one or two keys. That belong to special security profiles like "guest". Er, sorry for the security language - I am to used to it. What I meant to say was there are keys which we hand to our guest to allow them to leave and come back on their own. An other example is the key to the shed or the garage.

 

Enchantment

 

How could this ordinary object be improved with more functions?

First Idea is to make the offline functions available online. Second is to add functionality we are used to in the connected world to this object.

 

Planed features

  • Sharing status and state changes (“at home”, “out” , “leaving”, “arrived”) online
  • Displaying additional online status information through LEDs
  • Detect additional changes on the board (add / remove paper note)
  • Leaving speech messages

Challenges

  • Detection and identification of the key rings
  • User interface (I don't want to add buttons etc.)
  • and of course security

 

Security

 

Security is important, not only in this callenge. Therefore the security related problems deserve their own chapter:

  • Fair Rolles / rights concept
  • End to end encryption for all data shared over the internet
  • Leave as much data within the object as possible
  • "Harden" the object against attacks from the internet

Use of the Project's Results

 

For me this project will definitely be definitely a big learning experience - hopefully for others, too. Furthermore it will be the first and useful piece of my "Smart Home". If others can use parts or ideas, especially security, for other projects my goals would be over achieved. For all thos who made it this far: hope you'll join my in my next blog post, also!

rpbruiser

The Magic Lamp

Posted by rpbruiser Mar 16, 2015

Late one night...

You are sitting at your desk, doing your work in the late afternoon. Its a beautiful day outside and your desk is by a door, there is no need for you to have your lights on. But the sun begins to set, and you are stuck in the dark, too immersed in your work to get up and turn on the lights. Fortunately you have a magic lamp! This lamp has the power to know when the sun is setting and turn itself on.

 

                                                                                                     

And the Genie granted your wishes...

For a consumer friendly solution to all your lazy problems! The genie, Premier Farnell, poofed in all the tools need and all the workers necessary to turn your wish a reality. His new help toiled day and night until your wish came true. Your lights are now Smart. They will function independent of user input, minus the initial setup, and we will all live happily ever after.



To Be Continued...

Once upon a time

Deep in the forest is a small cottage owned by a timeless couple, Hans and Matilda who are doomed never to meet. When it is wet he goes outside but when it is dry she must leave the house. They lived a happy life in their cottage however and had regular visitors who were interested to know what they could tell them about the weather.

WeatherHouse.jpg

The storm

 

One night there was a terrible storm and Matilda was scared and hid in the back of the cottage. Outside Hans was transfixed as the torrents of rain washed around him. Just before dawn when the storm was at it's wildest the lightening struck. Fire raged around the house and their old fashioned temperature and humidity sensors were destroyed.

 

Help was at hand

 

Luckily Hans and Matilda has insured their house with a policy from Premier Farnell. As Hans was reading the conditions he was pleased to see that it was a new for old policy and they would have their sensors and displays replaced with modern electronic components. It was not going to be an easy challenge however as they had to complete all of the work themselves by Friday, 26th June or their policy would be void. Matilda wrote up a plan of action and put together a shopping list of parts not covered by Farnell.

Plan.png

The Wolf

 

Nearby in the forest lived a wolf, he danced with glee as he heard about the disaster that had befallen the enchanted cottage. He'd been selling weather reports to the locals and Hans and Matilda's service was costing him dear. He planned to setup a fake weather server and provide the wrong information hence discrediting our weather telling couple.

 

ManInMiddle.png

 

Next -Enchanted Objects Design Challenge - Remodelling the Enchanted Cottage

Note: Read more about the competitors and their projects by clicking here.
Thank you to all who applied for the Enchanted Objects Design Challenge - you gave a lot for Atmel and element14 to mull over.  After a tough set of decisions, we are pleased to announce that the fifteen competitors for the challenge are as follows:
We look forward to the exciting (and enchanted) blogs and projects to come!