The Alpha Geek – Geeking Out

Microcontrollers

Microcontrollers

Project #6: MicroView – Mk03

MicroView
Project #6 – Mk03

1 x MicroView
1 x DS18S20
1 x Resistor 1.65k Ohm
3 x Jumper Wires 3″ M/M

08 pin – GND
11 pim – 2
15 pin – +5V

DonLuc1804Mk05b.ino

// ***** Don Luc *****
// Software Version Information
// 3.01
// DonLuc1804Mk05 3.01
// MicroView
// OneWire
// DS18S20

#include <MicroView.h>
#include <OneWire.h>
// Temperature chip i/o
int DS18S20_Pin = 2; //DS18S20 Signal pin on digital 2
OneWire ds(DS18S20_Pin);  // on digital pin 2
float temperature = 0;
String tempZ = "";

void loop() {

  // Temperature chip i/o
  temperatu();
  isTe();
      
	uView.setFontType(1);
	uView.setCursor(0,20);
	uView.print("Don Luc");
	uView.display();
	delay(1000);
  
	uView.clear(PAGE);
	
}

getTemperature.ino

float getTemp() {
  
  //returns the temperature from one DS18S20 in DEG Celsius
  byte data[12];
  byte addr[8];
 
  if ( !ds.search(addr)) {
      //no more sensors on chain, reset search
      ds.reset_search();
      return -1001;
  }
 
  if ( OneWire::crc8( addr, 7) != addr[7]) {
      return -1002;
  }
 
  if ( addr[0] != 0x10 && addr[0] != 0x28) {
      return -1003;
  }
 
  ds.reset();
  ds.select(addr);
  ds.write(0x44,1); // start conversion, with parasite power on at the end
 
  byte present = ds.reset();
  ds.select(addr);    
  ds.write(0xBE); // Read Scratchpad
 
  
  for (int i = 0; i < 9; i++) { // we need 9 bytes
    data[i] = ds.read();
  }
  
  ds.reset_search();
  
  byte MSB = data[1];
  byte LSB = data[0];
 
  float tempRead = ((MSB << 8) | LSB); //using two's compliment
  float TemperatureSum = tempRead / 16;
  
  return TemperatureSum;
 
}
 
void temperatu(){
  
  temperature = getTemp();
 
}
 
void isTe() {

  tempZ = "";
  uView.setFontType(1);
  uView.setCursor(0,10);
  uView.print("Celsius");
  uView.setCursor(0,30);  
  tempZ.concat(temperature);
  tempZ.concat("C");
  uView.print( tempZ );
  uView.display();
  delay(5000);

  uView.clear(PAGE);
  
}

setup.ino

void setup() {
  
  uView.begin();       // begin of MicroView
  uView.clear(ALL);    // erase hardware memory inside the OLED controller
  uView.display();     // display the content in the buffer memory, by default it is the MicroView logo
  delay(1000);
  uView.clear(PAGE);   // erase the memory buffer, when next uView.display() is called, the OLED will be cleared.

  uView.setFontType(1);
  uView.setCursor(0,20);
  uView.print("Don Luc");
  uView.display();
  delay(5000);

  uView.clear(PAGE);   // erase the memory buffer, when next uView.display() is called, the OLED will be cleared.

  uView.setFontType(1);
  uView.setCursor(0,20);
  uView.print("OneWire");
  uView.display();
  delay(5000);
  
  uView.clear(PAGE); 

  uView.setFontType(1);
  uView.setCursor(0,20);
  uView.print("DS18S20");
  uView.display();
  delay(5000);
  
  uView.clear(PAGE);
   
}

Don Luc

Project #6: MicroView – Mk02

DonLuc1804Mk04a.ino

// ***** Don Luc *****
// Software Version Information
// 2.01
// DonLuc1804Mk04 2.01
// MicroView

#include <MicroView.h>
#include <Time.h>
#include <TimeLib.h>
// This is the radius of the clock:
#define CLOCK_SIZE 23
// Use these defines to set the clock's begin time
#define HOUR 9
#define MINUTE 00
#define SECOND 00
#define DAY 9
#define MONTH 4
#define YEAR 2018
// LCD W/H
const uint8_t maxW = uView.getLCDWidth();
const uint8_t midW = maxW/2;
const uint8_t maxH = uView.getLCDHeight();
const uint8_t midH = maxH/2;
// Clock
long zzz = 0;
static boolean firstDraw = false;
static unsigned long mSec = millis() + 1000;
static float degresshour, degressmin, degresssec, hourx, houry, minx, miny, secx, secy;
  
void loop() {

  drawFace();
  
  zzz = 0;
  while(zzz < 5000)
  {

     drawTime();
     zzz++;
     
  }
  
  uView.clear(PAGE);
  
  firstDraw = false;
  
  uView.setFontType(0);
  uView.setCursor(0,20);
  uView.print("09/04/2018");
  uView.display();
  delay(5000);
  
  uView.clear(PAGE);

}

drawFace.ino

void drawFace()
{

  // Draw the clock face. That includes the circle outline and
  // the 12, 3, 6, and 9 text.
  uView.setFontType(0); // set font type 0 (Smallest)
  
  uint8_t fontW = uView.getFontWidth();
  uint8_t fontH = uView.getFontHeight();
  
  //uView.setCursor(27, 0); // points cursor to x=27 y=0
  uView.setCursor(midW-fontW-1, midH-CLOCK_SIZE+1);
  uView.print(12);  // Print the "12"
  uView.setCursor(midW-(fontW/2)-1, midH+CLOCK_SIZE-fontH-1);
  uView.print(6);  // Print the "6"
  uView.setCursor(midW-CLOCK_SIZE+1, midH-fontH/2);
  uView.print(9);  // Print the "9"
  uView.setCursor(midW+CLOCK_SIZE-fontW-2, midH-fontH/2);
  uView.print(3);  // Print the "3"
  uView.circle(midW-1, midH-1, CLOCK_SIZE);
  
  //Draw the clock
  uView.display();
  
}

drawTime.ino

void drawTime()
{
   
  // If mSec
  if (mSec != (unsigned long)second()) 
  {
    // First time draw requires extra line to set up XOR's:
    if (firstDraw) 
    {
      uView.line(midW, midH, 32 + hourx, 24 + houry, WHITE, XOR);
      uView.line(midW, midH, 32 + minx, 24 + miny, WHITE, XOR);
      uView.line(midW, midH, 32 + secx, 24 + secy, WHITE, XOR);
    }
    // Calculate hour hand degrees:
    degresshour = (((hour() * 360) / 12) + 270) * (PI / 180);
    // Calculate minute hand degrees:
    degressmin = (((minute() * 360) / 60) + 270) * (PI / 180);
    // Calculate second hand degrees:
    degresssec = (((second() * 360) / 60) + 270) * (PI / 180);

    // Calculate x,y coordinates of hour hand:
    hourx = cos(degresshour) * (CLOCK_SIZE / 2.5);
    houry = sin(degresshour) * (CLOCK_SIZE / 2.5);
    // Calculate x,y coordinates of minute hand:
    minx = cos(degressmin) * (CLOCK_SIZE / 1.4);
    miny = sin(degressmin) * (CLOCK_SIZE / 1.4);
    // Calculate x,y coordinates of second hand:
    secx = cos(degresssec) * (CLOCK_SIZE / 1.1);
    secy = sin(degresssec) * (CLOCK_SIZE / 1.1);

    // Draw hands with the line function:
    uView.line(midW, midH, midW+hourx, midH+houry, WHITE, XOR);
    uView.line(midW, midH, midW+minx, midH+miny, WHITE, XOR);
    uView.line(midW, midH, midW+secx, midH+secy, WHITE, XOR);
    
    // Set firstDraw flag to true, so we don't do it again.
    firstDraw = true;
    
    // Actually draw the hands with the display() function.
    uView.display();
    
  }

}

setup.ino

void setup() {

  // Set the time in the time library:
  setTime(HOUR, MINUTE, SECOND, DAY, MONTH, YEAR);
 
  uView.begin();       // begin of MicroView
  uView.clear(ALL);    // erase hardware memory inside the OLED controller
  uView.display();     // display the content in the buffer memory, by default it is the MicroView logo
  delay(1000);
  uView.clear(PAGE);   // erase the memory buffer, when next uView.display() is called, the OLED will be cleared.

  uView.setFontType(1);
  uView.setCursor(0,20);
  uView.print("Don Luc");
  uView.display();
  delay(5000);
  
  uView.clear(PAGE);

  uView.display();  // display the content in the buffer

  // Draw clock face (circle outline & text):
  drawFace();
  
}

Don Luc

Project #6: MicroView – Mk01

DonLuc1804Mk03b.ino

// ***** Don Luc *****
// Software Version Information
// 1.01
// DonLuc1804Mk03 1.01
// MicroView

#include <MicroView.h>

void loop() {

	uView.setFontType(0);
	uView.setCursor(0,20);
	uView.print("  Don Luc  ");
	uView.display();
	delay(5000);

	uView.clear(PAGE);

	uView.setFontType(1);
	uView.setCursor(0,20);
	uView.print("Don Luc");
	uView.display();
	delay(5000);
  
	uView.clear(PAGE);
	
}

setup.ino

void setup() {
  
  uView.begin();       // begin of MicroView
  uView.clear(ALL);    // erase hardware memory inside the OLED controller
  uView.display();     // display the content in the buffer memory, by default it is the MicroView logo
  delay(1000);
  uView.clear(PAGE);   // erase the memory buffer, when next uView.display() is called, the OLED will be cleared.
  
}

MicroView
Project #6 – Mk01

Don Luc

Project #5: Lamps – Mk01

DonLuc1804Mk02.ino

// ***** Don Luc *****
// Software Version Information
// 1.01
// DonLuc1804Mk02 1.01
// Lamps

#include <Adafruit_NeoPixel.h>
// Which pin on the Arduino is connected to the NeoPixels
// Pin connected => 6
#define PIN 6
// How many NeoPixels are attached to the Arduino
// NUMPIXELS => 4
#define NUMPIXELS 4
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
// Panel Mount 1K potentiometer Bright
// Bright => A0
const int sensorBright = A0;
int sBright = 0;
int brightVal = 0;         // the sensor value
int brightMin = 0;        // minimum sensor value
int brightMax = 0;           // maximum sensor value
// Panel Mount 1K potentiometer
// Delay => A1
const int sensorDelay = A1;
long delayVal = 0;
// Rotary Switch - 10 Position
// Number => A2 (0 => 9)
const int sensorNumber = A2;
// Panel Mount 1K potentiometer
// Red - Led
const int sensorRed = 9;
int red = 0;
int redMin = 0;
int redMax = 0;
// Panel Mount 1K potentiometer
// Green - Led
const int sensorGreen = 8;
int green = 0;
int greenMin = 0;
int greenMax = 0;
// Panel Mount 1K potentiometer
// Blue - Led
const int sensorBlue = 7;
int blue = 0;
int blueMin = 0;
int blueMax = 0;
// variables:
//int x = 0;
int y = 0;
int z = 0;

void loop() {

  number();

}

bright.ino

void bright(){

    switch (sBright) {
        case 1:
            brightVal = 255;
            break;
         default:
            // read the sensor:
            brightVal = analogRead(sensorBright);
            // apply the calibration to the sensor reading
            brightVal = map(brightVal, brightMin, brightMax, 0, 255);        
            // in case the sensor value is outside the range seen during calibration
            brightVal = constrain(brightVal, 0, 255);
            break;
    }
  
}

iled.ino

void iled() {

   // red
   red = analogRead(sensorRed); 
   // apply the calibration to the sensor reading red
   red = map(red, redMin, redMax, 0, 255);
   // in case the sensor value is outside the range seen during calibration
   red = constrain(red, 0, 255);
   // green
   green = analogRead(sensorGreen); 
   // apply the calibration to the sensor reading red
   green = map(green, greenMin, greenMax, 0, 255);
   // in case the sensor value is outside the range seen during calibration
   green = constrain(green, 0, 255);
   // blue
   blue = analogRead(sensorBlue); 
   // apply the calibration to the sensor reading red
   blue = map(blue, blueMin, blueMax, 0, 255);
   // in case the sensor value is outside the range seen during calibration
   blue = constrain(blue, 0, 255);
                 
}

neopix.ino

void neopix() {
  
  for(int i=0; i<NUMPIXELS; i++){

    // bright
    bright();   
    pixels.setBrightness( brightVal );
    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255    
    pixels.setPixelColor(i, pixels.Color(red,green,blue));
    // show
    pixels.show(); // This sends the updated pixel color to the hardware.
    // delay
    delay(50); // Delay for a period of time (in milliseconds).
    
  }
  
}

neopixt.ino

void neopixt() {
  
  for(int i=4; i<NUMPIXELS; i--){

    // bright
    bright();   
    pixels.setBrightness( brightVal );
    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255    
    pixels.setPixelColor(i, pixels.Color(red,green,blue));
    // show
    pixels.show(); // This sends the updated pixel color to the hardware.
    // delay
    delay(50); // Delay for a period of time (in milliseconds).
    
  }
  
}

number.ino

void number(){

  z = analogRead(sensorNumber);
  y = (z / 127);

  sBright = 20000;
  
  // range value:
  switch (y) {
    case  0:
      // Led
      iled();
      // neopix
      neopix();
      // delay
      delayVal = (0);     
      break;
    case 1:
      // Led
      iled();
      // neopix
      neopix();
      // delay
      sdelay();
      break;
    case 2:
      // Led
      iled();
      // neopixt
      neopixt();
      // delay
      sdelay();
      break;
    case 3:
      // White
      red = 255;
      green = 255;
      blue = 255; 
      // neopix       
      neopix();
      // delay
      delayVal = (0);
      break;  
    case 4:
      // Green
      red = 0;
      green = 255;
      blue = 0;
      // neopix        
      neopix();
      // delay
      delayVal = (0);
      break;
    case 5:
      // Red
      red = 255;
      green = 0;
      blue = 0;        
      // neopix        
      neopix();
      // delay
      delayVal = (0);
      break;
    case 6:
      // White
      red = 255;
      green = 255;
      blue = 255; 
      // neopix       
      neopix();
      // delay
      sdelay();
      break;       
    case 7:
      // Green
      red = 0;
      green = 255;
      blue = 0; 
      // neopix       
      neopix();
      // delay
      sdelay();
      break; 
    case 8:
      // Red
      red = 255;
      green = 0;
      blue = 0; 
      // neopix       
      neopix();
      // delay
      sdelay();
      break; 
    case 9:

      break;
  }
  
}

sdelay.ino

void sdelay() {

    delayVal = analogRead(sensorDelay);
    delayVal = (250 * delayVal);
      
}

setup.ino

void setup() {
  
    pixels.begin(); // This initializes the NeoPixel library.
    
}

Don Luc

ArduiNIX

ArduiNIX: 8 x Nixie Tubes

The ArduiNIX shield is a user programmable platform for driving multiplexed Nixie tube or other high voltage displays.

The ArduiNIX shield uses digital data pins 2,3,4,5,6,7,8,9,10,11,12,13 on the Arduino.

AREF, IOREF, TX(digital 1), RX(digital 0), Analog 0-5, digital 18 and 19 are free to use as inputs/outputs.

An explanation of how the Arduinix works:

The ArduiNIX works by listening to a signal from the Arduino to tell it when to switch on one of the four anode pins., and when to switch on any single or combination of cathode channels in the two sets of 10 cathode sets that are controlled by the nixie tube driver chips.

The Anode pins go hot, send 180 volts to the nixie tube anode connection, and the system waits for the code to tell the arduinix to ground out one of the cathode pins that are controlled by the twoDriver ICs.

Once the Arduino code tells the ArduiNIX to open an anode channel, which is connected to the anode pin of your tube, and the code tells the ArduiNIX to ground out a cathode channel, 180 volts flow into the nixie tube, lighting the element that is connected to the cathode channel.

When multiplexing, you have one anode channel connected to two nixie tubes, and one set of nixie cathodes per cathode channels on the ArduiNIX. Doing so allows you to drive up to 8 ten element nixie tubes, pairs of tubes sharing anodes, alternating cathode grounds at a fast enough rate that we don’t see a flicker.

The ArduiNIX is 4×20 Multiplexed,meaning there are a total of 4 anodes and 20 cathodes that can be multiplexed and controlled through the code. This means that up to 80 signals can be controlled. Either eight 10 numeral tubes or 80 Neon bulbs like the INS-1. Or any combination of numeric tubes and dots.

The ArduiNIX V3 features Analog 0-5, GND, Reset, SCL, SDA, AREF, 5V, TX and RX broken out to an input/output section of headers at the front of the board near the cathode bank.

Don Luc

MODULO

What is Modulo?

Modulo is a set of tiny modular circuit boards that you can assemble to build powerful programmable electronics without needing to design and assemble circuits from scratch.

Modulos slide into a base which connects them and holds them securely. Modulo assembles in seconds but is nearly as solid, compact, and powerful as a custom-designed PCB!

How it works

Building projects with Modulo is ridiculously easy. Watch our video on how to get started or check out our handy guide below.

Start with a Base

Each base holds up to four Modulos. Bases can be connected together with extension cables if you need more room.

The Particle Base has a socket which accepts controllers like the wifi-connected Particle Photon, cellular connected Particle Electron, or bluetooth compatible Bluz.

Select a Controller

The Modulo controller is an high performance arduino-compatible microcontroller that slides into the Base, just like any other Modulo. It’s the most compact way to control your Modulo project. It can also act as a USB bridge so you can control Modulos from python running on a mac, PC, or single board computer.

Alternatively, you can use the Particle Photon, Particle Electron, or Bluz controller to build Wifi, Cellular, and Bluetooth connected projects respectively.

Add Modulos

Each Modulo is smart enough to handle all the low level details of its own operation, so you never need to worry about things like pin numbers or registers. We have an amazing set of Modulos available and will create more as time goes on.

Program away!

The Modulo API makes it a breeze to program your devices. You can use it from several development environments.

* Using the Arduino app, with code running on the Modulo controller or any other Arduino compatible microcontroller.
* Using particle.io’s awesome development environment with code running on the Particle Photon, Particle Electron, or Bluz. (Modulo Controller not required in this configuration)
* Using python, with code running on a mac, PC, or single board computer like a Raspberry Pi or BeagleBone. (requires a Modulo controller for connecting Modulo via USB)

Regardless of which programming environment you choose, we’ve made Modulo as simple and straightforward to program as possible. Want to learn more? Come join our community, we can’t wait to hear from you!

Don Luc

Raspberry Pi 3 Model B

Product Details

Raspberry Pi 3 Model B

The Raspberry Pi 3 Model B looks identical to the Pi 2 B at first glance. It is the same size and has much of the same components on board. So what is the difference? The new Pi 3 brings more processing power and on-board connectivity, saving you time with the development of your applications. Perfect for your Internet of Things (IoT) designs.

Pi 3 compared to Pi 2

* More processor speed. The CPU on the Pi 3 is one and a half times faster at 1.2 GHz. Your Pi board performs better.
* On-board connectivity. The Pi 3 features 802.11 b/g/n 2.4 GHz Wireless LAN and Bluetooth Classic & Low Energy (BLE). You can get connected much quicker without the need for any external device.
* 2.5 A power supply. With more processor speed and on-board connectivity, you’ll need more power. Power supplies for previous Pi boards will not be sufficient. You will need the Official Raspberry Pi 3 Power Supply (9098126 — white) or (9098135 — black).
* New components. The Pi 3 features a chip antenna where status LEDs were located previously. The status LEDs are still on the board, right next to the microSD card slot.

New to Raspberry Pi?

The Raspberry Pi is a single computer board — developed to encourage and aid the teaching of programming and computing. It is also a fantastic starting point for the development of the Internet of Things (IoT) projects. The low cost and ‘plug and play’ nature of Pi makes for a board that is accessible to all and has numerous connectivity options. Pi is the perfect experimental tool, whether you want to use it as a desktop computer, media centre, server or monitoring/security device within your home. No limits. Linux-based operating systems run on the Pi with plenty of access to free software and downloads. What is more, there is a great Pi community out there — look at DesignSpark, the design engineer community at RS.

Features & Benefits of the Pi 3

* Broadcom BCM2837 chipset running at 1.2 GHz
* 64-bit quad-core ARM Cortex-A53
* 802.11 b/g/n Wireless LAN
* Bluetooth 4.1 (Classic & Low Energy)
* Dual core Videocore IV® Multimedia co-processor
* 1 GB LPDDR2 memory
* Supports all the latest ARM GNU/Linux distributions and Windows 10 IoT
* microUSB connector for 2.5 A power supply
* 1 x 10/100 Ethernet port
* 1 x HDMI video/audio connector
* 1 x RCA video/audio connector
* 1 x CSI camera connector
* 4 x USB 2.0 ports
* 40 GPIO pins
* Chip antenna
* DSI display connector
* microSD card slot
* Dimensions: 85 x 56 x 17 mm

Don Luc

SparkFun MicroView – OLED Arduino Module

Sparkfun: DEV-12923

Description

The MicroView is the first chip-sized Arduino compatible module that lets you see what your Arduino is thinking using a built-in OLED display. With the on-board 64×48 pixel OLED, you can use the MicroView to display sensor data, emails, pin status, and more. It also fits nicely into a breadboard to make prototyping easy. The MicroView also has a full-featured Arduino library to make programming the module easy.

In the heart of MicroView there is ATMEL’s ATmega328P, 5V & 3.3V LDO and a 64×48 pixel OLED display, together with other passive components that allow the MicroView to operate without any external components other than a power supply. Additionally, the MicroView is 100% code compatible with Arduino Uno (ATmega328P version), meaning the code that runs on an Arduino Uno will also be able to run on the MicroView if the IO pins used in the code are externally exposed on the MicroView.

Features

* 64×48 Pixel OLED Display
* ATmega328P
* 5V Operational Voltage
* VIN Range: 3.3V – 16V
* 12 Digital I/O Pins (3 PWM)
* 6 Analog Inputs
* Breadboard Friendly DIP Package
* 32KB Flash Memory
* Arduino IDE 1.0+ Compatible

Don Luc

Categories
Archives