The example trace with higher and lower peaks is from an android blinkup, which uses white and gr[ea]y to clock data as Android devices can’t maintain regular framerates as well as iOS devices can. An iOS blinkup will look more like the one you posted - max light levels the same. Either way it seems like you should have more gain in your setup, which on anything aside from an imp005 means increasing the resistor value.
The blinkup algorithm can work with swings down to the 0.1x level (~0.3v swing), which is why you’ve not had issues, but the more margin the better - but saturation is bad for Android blinkups, hence the tuning process.
The 005 values look just plain strange, I suspect that this is because the example blinkup capture code disables blinkup and the 005 blinkup circuit takes time to get going, hence you can’t read hardware.lightlevel fast enough on that platform. Try enabling blinkup in the example code, then - when you do the blinkup you want to sample - ensuring you move the phone away before the blinkup completes so the device doesn’t see a valid packet and end up being blinked up inadvertently. You should then see a waveform much more like the ones you capture on other devices.
We do call out blinkup tuning being a required thing in the design guides, but often people see it working and skip that. This is generally not the best idea for field compatibility.
class BlinkUpTuner {
static NUMSAMPLES = 5000; // approximiately 5 seconds; sample rate ~ 1kHz
static function captureBlinkUp(dummy = null) {
// disable actual BlinkUp so that tuning tests don't reconfigure this device
// to use BlinkUp to reconfigure the device under test, power cycle the
// device under test and BlinkUp within 1 minute
//imp.enableblinkup(false);
// pre-allocate some space in the blob, assuming ~ 1k samples / second
// blob will be grown if necessary
local _blinkupData = blob(BlinkUpTuner.NUMSAMPLES);
// alias repeatedly-called methods for speed
local u = hardware.micros.bindenv(hardware);
local l = hardware.lightlevel.bindenv(hardware);
// sample start and end times to adjust delay for ~ 1kHz sampling
local prev = null;
local now = null;
// tight loop to collect samples
prev = u();
for (local n = 0; n < BlinkUpTuner.NUMSAMPLES; n++) {
_blinkupData.writen(u(), 'i'); // timestamp
_blinkupData.writen(l(), 'w'); // lightlevel
now = u();
imp.sleep(0.001 - ((now - prev) / 1000000.0));
prev = now;
}
_blinkupData.seek(0);
return _blinkupData;
}
}
agent.on("start", function(dummy) {
agent.send("blinkupData", BlinkUpTuner.captureBlinkUp());
});
Also you say the capacitor needs tuning, which capacitor on this schematic? C7? What sort of values should I be trying with? Looking at the above graph the top peaks probably need to go up another 0.2V
// Copyright (c) 2015 Electric Imp
// This file is licensed under the MIT License
// http://opensource.org/licenses/MIT
//
// BlinkUp Tuning Device Code
// Collects LightLevel samples and sends them to the agent to be graphed
class BlinkUpTuner {
static NUMSAMPLES = 5000; // approximiately 5 seconds; sample rate ~ 1kHz
static function captureBlinkUp(dummy = null) {
// disable actual BlinkUp so that tuning tests don't reconfigure this device
// to use BlinkUp to reconfigure the device under test, power cycle the
// device under test and BlinkUp within 1 minute
imp.enableblinkup(true);
// pre-allocate some space in the blob, assuming ~ 1k samples / second
// blob will be grown if necessary
local _blinkupData = blob(BlinkUpTuner.NUMSAMPLES);
// alias repeatedly-called methods for speed
local u = hardware.micros.bindenv(hardware);
local l = hardware.lightlevel.bindenv(hardware);
// sample start and end times to adjust delay for ~ 1kHz sampling
local prev = null;
local now = null;
// tight loop to collect samples
prev = u();
for (local n = 0; n < BlinkUpTuner.NUMSAMPLES; n++) {
_blinkupData.writen(u(), 'i'); // timestamp
_blinkupData.writen(l(), 'w'); // lightlevel
now = u();
imp.sleep(0.001 - ((now - prev) / 1000000.0));
prev = now;
}
_blinkupData.seek(0);
return _blinkupData;
}
}
agent.on("start", function(dummy) {
agent.send("blinkupData", BlinkUpTuner.captureBlinkUp());
});
Hmm, you’re correct, I can replicate this. I suspect this is related to blinkup power being disabled then re-enabled; will try forcing it on and seeing what happens.