Posts with «panel» label

Weather Station Is A Tutorial in Low Power Design

Building your own weather station is a fun project in itself, but building it to be self-sufficient and off-grid adds another set of challenges to the mix. You’ll need a battery and a solar panel to power the station, which means adding at least a regulator and charge controller to your build. If the panel and battery are small, you’ll also need to make some power-saving tweaks to the code as well. (Google Translate from Italian) The tricks that [Danilo Larizza] uses in his build are useful for more than just weather stations though, they’ll be perfect for anyone trying to optimize their off-grid projects for battery and solar panel size.

When it comes to power conservation, the low-hanging fruit is plucked first. [Danilo] set the measurement intervals to as long as possible and put the microcontroller (a NodeMCU) to sleep in between. Removing the power from the sensors when the microcontroller was asleep was another easy step, but the device was still crashing overnight. Then he turned to a hardware solution and added a more efficient battery charger to the setup, which saved even more power. This is all the more impressive because the station communicates via WiFi which is notoriously difficult to run in low-power applications.

Besides the low power optimizations, the weather station itself is interesting for its relative simplicity. It could be built with things most of us have knocking around. Best of all, [Danilo] published the source code on his site, so most of the hard work has been done already. If you’re thinking he seems a little familiar, it’s because we’ve featured some of his projects before, like his cheap WiFi extender antenna and his homemade hybrid tube amplifier.

Solar Panel System Monitoring Device Using Arduino

[Carl] recently upgraded his home with a solar panel system. This system compliments the electricity he gets from the grid by filling up a battery bank using free (as in beer) energy from the sun. The system came with a basic meter which really only shows the total amount of electricity the panels produce. [Carl] wanted to get more data out of his system. He managed to build his own monitor using an Arduino.

The trick of this build has to do with how the system works. The panel includes an LED light that blinks 1000 times for each kWh of electricity. [Carl] realized that if he could monitor the rate at which the LED is flashing, he could determine approximately how much energy is being generated at any given moment. We’ve seen similar projects in the past.

Like most people new to a technology, [Carl] built his project up by cobbling together other examples he found online. He started off by using a sketch that was originally designed to calculate the speed of a vehicle by measuring the time it took for the vehicle to pass between two points. [Carl] took this code and modified it to use a single photo resistor to detect the LED. He also built a sort of VU meter using several LEDs. The meter would increase and decrease proportionally to the reading on the electrical meter.

[Carl] continued improving on his system over time. He added an LCD panel so he could not only see the exact current measurement, but also the top measurement from the day. He put all of the electronics in a plastic tub and used a ribbon cable to move the LCD panel to a more convenient location. He also had his friend [Andy] clean up the Arduino code to make it easier for others to use as desired.


Filed under: Arduino Hacks

E-Paper Barcode 39

E-Paper (or Electronic paper) is a display technology that mimics the appearance of ordinary ink on paper. E-paper displays do not emit light, rather they reflect light, thus making them much more comfortable to read and provide a wider viewing angle than most light emitting displays (source: Wikipedia).

I printed something to an E-paper display, unplugged it, and could still read the message clearly months later. These E-paper displays are great for showing information that is static for long periods. You only need to provide power when the data or information needs updating.

Barcodes are used everywhere, and one of the simplest Barcodes to generate is the Code 39 format (also known as Code 3 of 9). I used an E-paper shield and E-paper module to display a number in this barcode format. I then tested it with a Barcode reader and it worked perfectly.
This tutorial will show you how to send a number to the Arduino from the Serial Monitor, and display the Barcode on the E-paper module.

Note: If you are using an Arduino UNO (or compatible), you will also need to get a micro SDHC card.
 

The Video


The video will show you how to assemble the shield and the module onto the Arduino, and also how to install the SDHC card.


 
 

Parts Required:

Library Download


To use the e-paper shield, you will need to download the Small e-paper Shield library.
This library will allow you to use the following functions on the e-paper shield:
  • begin : to set up the size of the e-paper panel
  • setDirection : to set up the display direction
  • drawChar : to display a Character at a specified position
  • drawString : to display a String of characters at a specified position
  • drawNumber and drawFloat : to display a number
  • drawLine : to draw a line
  • drawHorizontalLine : to draw a horizontal line
  • drawVerticalLine : to draw a vertical line
  • drawCircle : to draw a circle
  • fillCircle : to draw and fill a circle
  • drawRectangle : to draw a rectangle
  • fillRectangle : to draw and fill a rectangle
  • drawTriangle : to draw a triangle
You can also draw an image to the e-paper shield.

For more information on how to use these functions, please visit the seeedstudio wiki. If you are unfamiliar with installing libraries - then have a look at the following sites:

Barcode 39 Info

Barcode 39 (or Code 3 of 9) is a barcode that consists of black and white vertical lines. These lines can be thick or thin. Each character can be coded using 9 alternating black and white bars. The barcode always starts with a black bar, and ends with a black bar.

If you code using thin lines only, then each character can be coded using a total of 12 bars. A wide black line is essentially two thin black lines next to each other. Same goes for a wide white line. Because there are now only 2 options (black or white), you can create a binary code. I used a 1 for black bars, and 0 for white bars. If there was a thick black bar, then this would be represented with a 11. A thick white bar would be 00.

Each barcode sequence starts and ends with a hidden * character. Therefore if you were to display just the number 1, you would have to provide the code for *1*.

  • * = 100101101101
  • 1 = 110100101011
  • * = 100101101101
Notice that each character starts with a 1 and ends with a 1.
Something also to take note of: is that each character is separated by a thin white line (and not represented in the binary code).

All of these 0's and 1's can get a bit confusing, so I decided to represent these binary numbers as decimals. For example, the picture below shows how a 0 and an 8 would be coded (without the *):

 



The table below provides the binary and decimal codes for each number used in this tutorial. I have also included for your own reference, each letter of the alphabet, however I did not use these in this tutorial.

The binary representation of each character in this table was obtained from this site.
www.barcodeisland.com is a great resource of information about barcodes.

I adapted their binary code into a decimal equivalent, and therefore had to create my own table.

 
 

Arduino Sketch


 
  1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113


/* ===============================================================
      Project: Display Barcodes on an e-Paper Panel
       Author: Scott C
      Created: 6th January 2015
  Arduino IDE: 1.0.5
      Website: http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html
  Description: This project will allow you to send a number from the Serial 
               Monitor to the Arduino. The number will then be displayed on 
               the e-Paper panel as a Code-39 barcode (and text).
================================================================== */

#include <ePaper.h>
#include <SPI.h>
#include <SD.h>
#include "GT20L16_drive.h"

const int maxBarcodeSize = 10; // set the maximum barcode size to 10 digits
int barcode[maxBarcodeSize]; // initialise the barcode array to the maximum 10 digits
int barcodeText[maxBarcodeSize]; // initialise the barcodeText array to the maximum 10 digits
int barcodePos; // Used to identify each digit within the barcode
int barcodeLength; // Used to identify the actual length of the barcode

/*  The following array holds the decimal code for each digit (0-9). 
    Each digit can be converted to binary and then drawn as a barcode.
                         0     1     2     3     4     5     6     7     8     9         */
int barcodeDecimal[] = {2669, 3371, 2859, 3477, 2667, 3381, 2869, 2651, 3373, 2861};

int astrix = 2413; // "*" character decimal code used at beginning and end of barcode sequence


/*  When drawBarcode = "no", the program will not draw the barcode on the e-paper panel
    When drawBarcode = "yes", the command to draw the barcode on the e-paper panel will be triggered. */
String drawBarcode = "no";


/*  This variable is the x Position on the e-Paper panel screen */
int xPosition;


void setup(){
    Serial.begin(9600); // Initialise Serial communication
    EPAPER.begin(EPD_2_0); // Set the e-Paper panel size to 2 inches
    EPAPER.setDirection(DIRNORMAL); // Set the e-Paper panel display direction (to Normal)
    eSD.begin(EPD_2_0); // Prepares the SD card
    GT20L16.begin(); // Initialise the GT20L16 font chip on the e-Paper panel
    barcodePos = 0;                    // Set the barcode digit to the first digit in the barcode
    EPAPER.clear_sd(); // Clear the screen when starting sketch
    
    EPAPER.drawString("http://arduinobasics", 10, 20); //splash screen text
    EPAPER.drawString(".blogspot.com", 60, 40);
    
    EPAPER.display(); // Display the splash screen
}


void loop(){
  
    // The Arduino will wait until it receives data from the Serial COM port
    
    while (Serial.available()>0){
      barcodeText[barcodePos] = Serial.read();
        
      if(barcodeText[barcodePos]>47 && barcodeText[barcodePos]<58){ // A number was sent
         barcode[barcodePos] = barcodeText[barcodePos]-48;            // Convert the decimal value from the serial monitor to a Number
      } 
      
      if(barcodeText[barcodePos]==46){ // If a "." is detected, then barcode is complete
        barcodeLength = barcodePos;                   // Set the length of the barcode (used later)
        drawBarcode = "yes"; // We can now draw the barcode
        
      }
      
      if(barcodePos>(maxBarcodeSize-1)){ // Check if maximum barcode length has been reached
       barcodeLength = barcodePos;                    // Set the length of the barcode (used later)
       drawBarcode = "yes"; // We can now draw the barcode
      }
     
       barcodePos++;                                  // Move to the next barcode digit
    }
    
    if(drawBarcode == "yes"){ // Only draw the barcode when drawBarcode = "yes"
      
      EPAPER.clear_sd(); // Clear the e-Paper panel in preparation for barcode
      xPosition = 15;                                 // Set the initial white-space on the left
      drawBCode(astrix, ' '); // Each barcode starts with an invisible *
      
      for(int digit=0; digit<barcodeLength; digit++){ // Start drawing the barcode numbers
        drawBCode(barcodeDecimal[barcode[digit]], barcodeText[digit]);  // Call the drawBCode method (see below)
      }
      
      drawBCode(astrix, ' '); // Each barcode ends with an invisible *
      EPAPER.display(); // Show the barcode image and text
      
      drawBarcode = "no"; // Stop it from drawing again until next barcode sequence sent
      barcodePos=0;                                   // Re-initialise the position back to first digit (in preparation for the next barcode)
    }
}


//The drawBCode method is the key method for drawing the barcode on the e-paper panel
void drawBCode(int bCode, char bCodeText){
  xPosition++;                                        // There is a white space between each digit
  for (int barPos = 11; barPos > -1; barPos--){ // Cycle through the binary code for each digit. Each digit is made up of 11 bars
    xPosition++;                                      // Advance the xPosition to draw the next bar (white or black)
    if(bitRead(bCode, barPos)==1){ // If the binary digit at this position is a 1, then draw a black line
      EPAPER.drawVerticalLine(xPosition, 10, 60); // This draws the individual Bar (black - only)
    }                                                 // If the binary digit is a 0, then it is left blank (or white).
  }
  EPAPER.drawChar(bCodeText, xPosition-9, 75); // Draw the human readable (text) portion of the barcode
}


 


 

There is something weird about the E-paper shield library which tends to display the word "temperature:" in the Serial monitor when opened, and with each serial transmission. Don't worry about this. Just ignore it.'


This tutorial shows you how to create your own renewable barcodes. While this only handles numbers at this stage, it could just as easily be upgraded to handle text as well. If you liked this tutorial, please give it a google+ thumbs up, share it with your friends, or just write a comment. Thankyou for visiting my blog.



If you like this page, please do me a favour and show your appreciation :

 
Visit my ArduinoBasics Google + page.
Follow me on Twitter by looking for ScottC @ArduinoBasics.
Have a look at my videos on my YouTube channel.


 
 

 
 
 



However, if you do not have a google profile...
Feel free to share this page with your friends in any way you see fit.

Custom Electronics and LED Panels Brighten Up a Nightclub

When [Robert] is presented with a challenge, he doesn’t back down. His friend dreamed of reusing some old LED panels by mounting them to the ceiling of the friend’s night club. Each panel consists of a grid of five by five red, green, and blue LEDs for a total of 75 LEDs per panel. It sounded like a relatively simple task but there were a few caveats. First, the controller box that came with the panels could only handle 16 panels and the friend wanted to control 24 of them. Second, the only input device for the controller was an infrared remote. The friend wanted an easy way for DJ’s to control the color of the panels and the infrared remote was not going to cut it. Oh yea, he also gave [Robert] just three weeks to make this happen.

[Robert] started out by building a circuit that could be duplicated to control each panel. The brain of this circuit is an ATtiny2313. For communication between panels, [Robert] chose to go with the DMX protocol. This was a good choice considering DMX is commonly used to control stage lighting effects. The SN75176 IC was chosen to handle this communication. In his haste to get this PCB manufactured [Robert] failed to realize that the LED panels were designed common cathode, as opposed to his 25 shiny new PCB’s which were designed to work with a common anode design. To remedy this, he switched out all of the n-channel MOSFET with p-channel MOSFET. He also spent a couple of hours manually cutting through traces and rewiring the board. After all of this, he discovered yet another problem. The LED’s were being powered from the same 5V source as the microcontroller. This lead to power supply issues resulting in the ATtiny constantly resetting. The solution was to add some capacitors.

Click past the break for more on [Robert's] LED panels.

As for software, [Robert] completely filled the ATtiny’s memory. He used three channels to control red, green, and blue. He added a fourth channel to control pre-designed animation effects such as fading, strobe, and random color. The DIP switches are normally used to set the address of the panel, but there is a second option to put the panel into standalone mode. In this mode, the switches are used to program the panel to perform specific effects with no DMX controller required.

Now that the panels were all designed and functioning, [Robert] still needed a way to control them. He used the laser cutter at Shackspace hackerspace to design the actual panel face and then mounted a bunch of buttons, switches, and potentiometers to it. All of those things were connected to a Teensy3 using perfboard and a hand wired circuit. Another SN75176 IC was used for the DMX communication from the control panel. The control panel allows the DJ to change between different pre-built animation effects, color effects, and also change the speed of the animations to match the speed of the music.

 


Filed under: led hacks
Hack a Day 31 May 12:00