Avatar for Rek

Rek

Member since Apr 2015 • Last active Sep 2017
  • 6 conversations
  • 37 comments

Most recent activity

  • in Electronics
    Avatar for Rek

    I have been tasked to come up with a novelty light which will switch on or off when the housing is slapped.

    I will need a fairly sensitive shock/vibration sensor to do the job, can anyone suggest a component that will do the job and is compatible with the espruino?

  • in Projects
    Avatar for Rek

    This was for a letter box in a theme camp for australias version of Burning Man. Ran off of a phone backup battery which surprisingly lasted all week running the 5 LEDs

  • in Projects
    Avatar for Rek

    https://www.youtube.com/watch?v=NBf4JKfl­nyA

    var distance = 0;
    var running;
    var on = 1;
    var global = [0,0,0,0,0,0,0,0,0,0,0,150,1,0];
    
    
    var sensor = require("HC-SR04").connect(A0,A1,functio­n(dist) {
      distance = dist;
    });
    
    SPI2.setup({baud:3200000, mosi:B15});
    
    function runIt(){
      sensor.trigger();
      if (distance > 9.5){
        noMail();
      }else{
          gotMail();
      }
    }
    
    function switchit(){
      if (on){
        clearInterval(running);
        on = 0;
      } else {
        global[11] = Math.floor((Math.random() * 100) + 50);
        running = setInterval(runIt, global[11]);
        on = 1;
      }
    }
    
    
    function gotMail(){
      
      if(global[1] > 255){
        global[1] = 0;
      }
      if(global[2] > 255){
        global[2] = 0;
      }
      if(global[4] > 50){
        global[4] = 11;
      }
      
      switch(global[4]) {
        case 0:
            blackOut();
            break;
        case 1:
            SPI2.send4bit([0,0,0,         0,0,0,      0,0,0,         0,0,0,             50,0,0,         255,255,255], 0b0001, 0b0011);
            break;
        case 2:
            SPI2.send4bit([0,0,0,          0,0,0,     0,0,0,         50,0,0,            100,0,0,       255,255,255], 0b0001, 0b0011);
            break;
        case 3:
            SPI2.send4bit([0,0,0,       0,0,0,       50,0,0,         100,0,0,        155,50,0,         255,255,255], 0b0001, 0b0011);
            break;
        case 4:
            SPI2.send4bit([0,0,0,      50,0,0,      100,0,0,        155,50,0,        255,150,0,       255,255,255], 0b0001, 0b0011);
            break;
        case 5:
            SPI2.send4bit([50,0,0,     100,0,0,      55,50,0,       255,150,0,        255,255,255,       255,255,255], 0b0001, 0b0011);
            break;
        case 6:
            SPI2.send4bit([100,0,0,    55,50,0,     255,255,255,   255,255,255,         255,255,255,        255,255,255], 0b0001, 0b0011);
            break;
        case 7:
            SPI2.send4bit([255,255,255,      255,255,255,      255,255,255,       255,255,255,       255,255,255,       255,255,255], 0b0001, 0b0011);
            break;
        case 8:
            SPI2.send4bit([255,255,255,      255,255,255,      255,255,255,       255,255,255,       255,255,255,       255,255,255], 0b0001, 0b0011);
            break;
        case 9:
            SPI2.send4bit([255,255,255,      255,255,255,      255,255,255,       255,255,255,       255,255,255,       255,255,255], 0b0001, 0b0011);
            break;
        case 10:
            blackOut();
            break;
        case 11:
            SPI2.send4bit([2,0,0,      2,0,0,       2,0,0,       2,0,0,        2,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 12:
            SPI2.send4bit([4,0,0,      4,0,0,       4,0,0,       4,0,0,        4,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 13:
            SPI2.send4bit([6,0,0,      6,0,0,       6,0,0,       6,0,0,        6,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 14:
            SPI2.send4bit([8,0,0,      8,0,0,       8,0,0,       8,0,0,        8,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 15:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 16:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 17:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 18:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 19:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 20:
            SPI2.send4bit([30,0,0,     20,0,0,      20,0,0,      20,0,0,       20,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 21:
            SPI2.send4bit([155,50,0,   30,0,0,      20,0,0,     20,0,0,       20,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 22:
            SPI2.send4bit([30,0,0,     155,50,0,     30,0,0,        20,0,0,      20,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 23:
            SPI2.send4bit([20,0,0,     30,0,0,       155,50,0,        30,0,0,     20,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 24:
            SPI2.send4bit([20,0,0,     20,0,0,       30,0,0,        155,50,0,      30,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 25:
            SPI2.send4bit([20,0,0,     20,0,0,       20,0,0,        30,0,0,      155,50,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 26:
            SPI2.send4bit([20,0,0,     20,0,0,       20,0,0,        20,0,0,      30,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 27:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 28:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 29:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 30:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 31:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 32:
            SPI2.send4bit([30,0,0,     20,0,0,      20,0,0,      20,0,0,       20,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 33:
            SPI2.send4bit([155,50,0,   30,0,0,      20,0,0,     20,0,0,       20,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 34:
            SPI2.send4bit([30,0,0,     155,50,0,     30,0,0,        20,0,0,      20,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 35:
            SPI2.send4bit([20,0,0,     30,0,0,       155,50,0,        30,0,0,     20,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 36:
            SPI2.send4bit([20,0,0,     20,0,0,       30,0,0,        155,50,0,      30,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 37:
            SPI2.send4bit([20,0,0,     20,0,0,       20,0,0,        30,0,0,      155,50,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 38:
            SPI2.send4bit([20,0,0,     20,0,0,       20,0,0,        20,0,0,      30,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 39:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 40:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 41:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 42:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 43:
            SPI2.send4bit([10,0,0,     10,0,0,      10,0,0,      10,0,0,       10,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 44:
            SPI2.send4bit([50,0,0,     100,0,0,       150,0,0,        200,0,0,      50,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 45:
            SPI2.send4bit([155,50,0,     100,0,0,       150,0,0,        200,0,0,      50,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 46:
            SPI2.send4bit([50,0,0,     155,50,0,       150,0,0,        200,0,0,      50,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 47:
            SPI2.send4bit([50,0,0,     100,0,0,       155,50,0,        200,0,0,      50,0,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 48:
            SPI2.send4bit([50,0,0,     100,0,0,       150,0,0,        155,50,0,      50,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        case 49:
            SPI2.send4bit([50,0,0,     100,0,0,       150,0,0,        200,0,0,      155,50,0,       0,255,0], 0b0001, 0b0011); // white
            break;
        case 50:
            SPI2.send4bit([50,0,0,     100,0,0,       150,0,0,        200,0,0,      50,0,0,       255,255,255], 0b0001, 0b0011); // white
            break;
        default:
            SPI2.send4bit([50,0,0,     100,0,0,       150,0,0,        200,0,0,      50,0,0,       0,255,0], 0b0001, 0b0011); // white
      }
    
      global[1] += 5;
      global[2] += 2;
      global[4] += 1;
    }
    
    
    function noMail(){
      if(global[3] > 5){
        global[3] = 0;
      }
      if (global[4] !== 0){
        switchit();
        global[4] = 0;
        switchit();
      }
      if(global[1] > 255){
        global[8] = 0;
        global[1] = 255;
      }
      if(global[1] < 0){
        global[8] = 1;
        global[1] = 0;
      }
      if(global[5] > 255){
        global[6] = 0;
        global[5] = 255;
      }
      if(global[5] < 0){
        global[6] = 1;
        global[5] = 0;
      }
      if(global[2] > 255){
        global[7] = 0;
        global[2] = 255;
      }
      if(global[2] < 0){
        global[7] = 1;
        global[2] = 0;
      }
      if(global[9] > 100){
        global[10] = 0;
        global[9] = 100;
      }
      if(global[9] < 0){
        global[10] = 1;
        global[9] = 0;
      }
      if(global[13] > 1000){
        global[13] = 0;
        if (global[12] === 0){
          global[12] = 1;
        } else {
          global[12] = 0;
        }
      }
      
      if (global[12] === 0){
        switch(global[3]) {
          case 0:
              SPI2.send4bit([global[2],global[1],globa­l[5],  0,0,global[9],      0,0,global[1],           0,0,global[9],            0,0,global[1],      global[1],0,0], 0b0001, 0b0011);
              break;
          case 1:
              SPI2.send4bit([25,25,global[1],      global[2],global[1],global[5],  0,0,global[1],        0,0,global[9],            0,0,global[1],        global[1],0,0], 0b0001, 0b0011);
              break;
          case 2:
              SPI2.send4bit([0,0,global[1],         25,25,global[9],       global[2],global[1],global[5],   0,0,global[1],        0,0,global[1],      global[1],0,0], 0b0001, 0b0011);
              break;
          case 3:
              SPI2.send4bit([0,0,global[1],      0,0,global[9],      25,25,50,        global[2],global[1],global[5],     0,0,global[1],     global[1],0,0], 0b0001, 0b0011);
              break;
          case 4:
              SPI2.send4bit([0,0,global[1],      0,0,global[9],      0,0,global[1],        25,25,global[9],        global[2],global[1],global[5],  global[1],0,0], 0b0001, 0b0011);
              break;
          default:
              SPI2.send4bit([0,0,global[1],     0,0,global[9],      0,0,global[1],        0,0,global[9],         25,25,global[1], global[1],0,0], 0b0001, 0b0011);
        }
        global[3] += 1;
      } else {
         SPI2.send4bit([global[1],global[5],globa­l[9],global[5],global[2],global[1],globa­l[5],global[1],global[2],global[5],globa­l[2],global[1],global[1],global[5],globa­l[9],global[9],0,0], 0b0001, 0b0011);
      }
      global[13] += 1;
      
      if (global[6] == 1){
        global[5] += 1;
      } else{
        global[5] -= 1;
      }
      
      if (global[7] == 1){
        global[2] += 2;
      } else {
        global[2] -= 2;
      }
      
      if (global[8] == 1){
        global[1] += 5;
      } else {
        global[1] -= 5;
      }
      if (global[10] == 1){
        global[9] += 10;
      } else {
        global[9] -= 10;
      }
    
    }
    
    function blackOut(){SPI2.send4bit([0,0,0,  0,0,0,  0,0,0,  0,0,0,  0,0,0,  0,0,0], 0b0001, 0b0011);}
    
    running = setInterval(runIt, 200);
    
    setWatch(switchit, BTN1, {repeat:true, edge:"rising"});
    
  • in Projects
    Avatar for Rek

    Sorry I have been away, I am back on the project now with only a couple of weeks to get this done.

    I have had a hell of a time trying to solder the small pins at the end of the pico, I am sure there is a secret to it, I just have not worked it out yet.

    I will add to the thread soon

  • in General
    Avatar for Rek

    I had a lot of issue getting the drivers to work on windows 7 64. Even now the IDE does not show debug output but at least I can push to the espruino.

    Use the instructions Gordon has supplied - however you will have to go in to device manager and access the "drivers" tab for the unknown com device and manually point to the file that is unzipped with the driver download, it was greyed out for me when I tried to update drivers via the "devices and printers" window.

  • in Projects
    Avatar for Rek

    @gordon well I blew up my emitter!

    A capacitor exploded in the emitter while I was testing the DMX signal, it didn't simply pop its top, it blew in to pieces!

    I am not sure if it was a fault with the emitter or if the DMX shield sent enough current to overload the capacitor, I tested it with tx to tx first, and was not seeing any results, so I switched it over to RX on the shield, was playing around in the IDE and BOOM.

    When I measure the pins in the DMX shield it seems to be putting out half a volt consistently flowing from the bottom pin to each of the top pins (3 pin DMX) while plugged into RX on the shield

    When plugged into TX on the shield it reads .08v flowing in the other direction.

    I cant seem to measure any amps when I test with the multimeter in either configuration however, which seems weird to me, though I am no electronics guru.

    Think it was the negative voltage flow that killed it? I would be cautious to try again as these emitters are not cheap.

    It is a pity that DMX shield has no documentation, otherwise it would not be such a guessing game.

  • in Projects
    Avatar for Rek

    Ok, well I will do a learning experiment and let you know the results.

Actions