ceberocks
Published

Lytograph - smart wifi display

Lytograph is a smart wifi display for the internet of things.

AdvancedShowcase (no instructions)5,086
Lytograph - smart wifi display

Things used in this project

Hardware components

Arduino MKR1000
Arduino MKR1000
×1
Adafruit MicroSD card breakout board
×1
Shift Register- Serial to Parallel
Texas Instruments Shift Register- Serial to Parallel
×2
white LED 5mm 20mA
×81
vial glass
×81
wooden plate 34cm x 34cm
×2
beech plate 34cm x 6cm
×4
aluminium bar 32cm
×8
2 pole cable 10cm female to female
×81
Power MOSFET N-Channel
Power MOSFET N-Channel
×10
MOSFET P-Channel
×9
Resistor 10k ohm
Resistor 10k ohm
×23
Adafruit PowerBoost 500 Basic
×1
LiPo Battery
×1
torx screw
×70
Rugged Metal Pushbutton with Green LED Ring - 16mm
×1
Rugged Metal Pushbutton with Blue LED Ring - 16mm
×1
USB Cable, Micro-B to Standard-B Panel Mount Adaptor
×1
Male Header 40 Position 1 Row (0.1")
Male Header 40 Position 1 Row (0.1")
×15
sealing ring 1cm diameter
×81
micro sd card
×1
Audio jack connector female 3.5 mm
×1
wall mount disc
×4
1N4007 – High Voltage, High Current Rated Diode
1N4007 – High Voltage, High Current Rated Diode
×2

Software apps and online services

node.js
react.js

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Drill machine + rig

Story

Read more

Schematics

exterior

bulb dimensions

sideview

Code

main.cpp

C/C++
#include <sam.h>
#include <ArduinoJson.h>
#include <RTCZero.h>
#include "Wifi.h"
#include "SerialHandler.h"
#include "SDR.h"
#include "Buttons.h"
#include "Display.h"
#include "Constants.h"

int opMode = MXWifiTransfer;

Display display(Serial);
SDR sd(Serial);
Buttons buttonhandler;
Wifi wifi(Serial);
SerialHandler serialHandler(Serial);

void setup() {

  Serial.begin(9600);

  //sd.deleteConfig();
  sd.setupSD();
  sd.readConfig();
  //sd.printSDStatus();
  buttonhandler.setupButtons();
  display.setupDisplay();

  // Enable clock for TC
  REG_GCLK_CLKCTRL = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID_TCC0_TCC1) ;
  while ( GCLK->STATUS.bit.SYNCBUSY == 1 ); // wait for sync


  // The type cast must fit with the selected timer
  Tcc* TC = (Tcc*) TCC0; // get timer struct

  TC->CTRLA.reg &= ~TCC_CTRLA_ENABLE;   // Disable TC
  while (TC->SYNCBUSY.bit.ENABLE == 1); // wait for sync


  TC->CTRLA.reg |= TCC_CTRLA_PRESCALER_DIV256;   // Set prescaler


  TC->WAVE.reg |= TCC_WAVE_WAVEGEN_NFRQ;   // Set wave form configuration
  while (TC->SYNCBUSY.bit.WAVE == 1); // wait for sync

  TC->PER.reg = 30;              // Set counter Top using the PER register
  while (TC->SYNCBUSY.bit.PER == 1); // wait for sync

  TC->CC[0].reg = 0xFFF;
  while (TC->SYNCBUSY.bit.CC0 == 1); // wait for sync

  // Interrupts
  TC->INTENSET.reg = 0;                 // disable all interrupts
  TC->INTENSET.bit.OVF = 1;          // enable overfollow
  TC->INTENSET.bit.MC0 = 1;          // enable compare match to CC0

  // Enable InterruptVector
  NVIC_EnableIRQ(TCC0_IRQn);

  // Enable TC
  TC->CTRLA.reg |= TCC_CTRLA_ENABLE ;
  while (TC->SYNCBUSY.bit.ENABLE == 1); // wait for sync

  sd.playSequence("/FUNCTION/SEQUENCE/SEQUENCE.OBJ");

  if(autoConnect){
    wifi.wifiConnect();
  }

}

void TCC0_Handler() {

  display.display();

  Tcc* TC = (Tcc*) TCC0;       // get timer struct
  if (TC->INTFLAG.bit.OVF == 1) {  // A overflow caused the interrupt
    TC->INTFLAG.bit.OVF = 1;    // writing a one clears the flag ovf flag
  }

  if (TC->INTFLAG.bit.MC0 == 1) {  // A compare to cc0 caused the interrupt
    TC->INTFLAG.bit.MC0 = 1;    // writing a one clears the flag ovf flag
  }

}

void loop() {

  if(opMode==MXSerialTransfer){
    serialHandler.regularTasks();
  }
  else if(opMode==MXWifiTransfer){
    wifi.regularTasks();
  }

  buttonhandler.regularTasks();

}

Credits

ceberocks

ceberocks

0 projects • 0 followers

Comments