P10(1R) Dot Matrix Display Interfacing With Arduino

 The dot matrix display that I have is P10(1R), 

Don’t worry about the upper section being empty, I later did program it to show text 


Actual display Board 

Back Part [ PCB ] 


It is P10(1R)-DP4 536-V5 Type 


The closest datasheet that I got for this is http://www.hlec.com.cn/userfiles/files/20120928014657.pdf 


These Large Display Boards have multiple Units cascaded together. I call each unit a Panel 

So Multiple Panels being chained together make a large display board 


Here is how my board and it panels are chained to form the large display 



The Blue colored Double lines are the long jumper wires that chains each panel with another 


Now here is more info related to the Display 

  • Pixels per Panel is 32 (W)*16 (H) dots 

  • The board has 4 panels per chain 

  • The board has 2 chains 

  • So 8 panels in total 

  • So the total resolution is 320(w)x32(h) 


The pin interface is called HUB12, I have interfaced it with Arduino Uno 


Marking on the PCB 

HUB12 pinout at the datasheet 

Arduino Uno Pin Interface 



Here is where How you should connect Arduino Uno with the Display 


So you connect the Arduino Uno to the HUB12 interface to the panel located at [0,0] position 

Notice Panel 4 is chained to Panel 5 HUB12 interface by long jumper wire 


The Connection between HUB12 and Arduino Uno is 

Ref: http://cdn.shopify.com/s/files/1/0045/8932/files/DMDCON_DMDConnector.pdf?100730 


HUB12

Arduino

nOE

9

A

6

B

7

CLK

13

SCLK

8

R_DATA

11

GND

GND 


MOST Important: Use an External power Supply like this to power up the Display Board. Arduino is just for applying the logic. Don’t ever think it can power up the display board 😄


Now let’s prepare the Arduino Code 

At first, we have to install the libraries 


  1. Download this library https://github.com/freetronics/DMD 


Extract it and copy it to the Arduino libraries folder for example in my case   “/home/ayx/Arduino/libraries” 

     

     2. Open Arduino IDE and Install “TImerOne” Library using the “manage libraries” option 


Open Dmd_demo.ino sketch 

Change The code snippet like this 


//SPI.h must be included as DMD is written by SPI
#include <SPI.h>       
#include <DMD.h>       
#include <TimerOne.h>  
#include "SystemFont5x7.h"
#include "Arial_black_16.h"
#include "Droid_Sans_24.h"

//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 4
#define DISPLAYS_DOWN 2
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);

void ScanDMD()
{
  dmd.scanDisplayBySPI();
}
void setup(void)
{
  Timer1.initialize( 3000 );//period in microseconds to call ScanDMD.
  Timer1.attachInterrupt( ScanDMD );//attach the Timer1 interrupt to scan
  dmd.clearScreen( true );    //clearthe DMD pixels held in RAM
  dmd.selectFont(Droid_Sans_24);
}
void loop(void)
{
  dmd.clearScreen( true );
  delay(2000);
  dmd.drawMarquee("Scrolling Text",14,(32*DISPLAYS_ACROSS)-1,6);
}


Compile it and upload you, if everything is okay then you will see a large text scrolling 


A talk about Lora

Lora & LoraWan: 

Lora is actually a unique proprietary modulation format (phi layer). Semtech is the owner of the Lora RF technology and they give licenses to others.

LoraWan (MAC layer ) is an open standard maintained by Lora Alliance

RF basics of Lora : 
  • A Lora Signal starts with a preamble signal & has a constant ramp chirp inside.
  • The number symbols in a preamble signal = number of chirps/number of peaks of the ramp signal. 
  • Lora has the ability to demodulate several orthogonal/simultaneous signals at the same time. this function is implemented in the gateway chips like SX1301 where all the nodes connect.
  • LoRa RF physical layer uses a form of spread spectrum modulation.
  • To maximize battery lifetime or to maximize signal transmission distance the transmission power level used in the Lora chip can be decreased or increased.  
  • The communication between different end-devices and gateways can be on several different frequency channels and they can use different data rates.
  • The use of the chirp spread spectrum technology enables communications with different data rates not to interfere with each other. In this way, a set of "virtual" channels can be created which increases the capacity of the gateway.
LoRa-Preamble.jpg
Signal-Detection
LoRa-modulation.jpg
Signal Demodulate

Frequency and bandwidth: 

The LoRa wireless system makes use of the unlicensed frequencies that are available worldwide. The most widely used frequencies/bands are:
  • 868 MHz for Europe
  • 915 MHz for North America
  • 433 MHz band for Asia
Basically operating at lower frequencies than those of the 2.4 or 5.8 GHz ISM bands enables much better coverage to be achieved especially when the nodes are within buildings

back In August 2015, the GSMA (Groupe Speciale Mobile Association)—a group made up of mobile operators—announced that it plans on standardizing LPWAN technology on a licensed spectrum by early 2016. This push has received endorsements and backing from companies like“AT&T, Bell Canada, China Mobile, China Telecom, China Unicom, Deutsche Telekom, Etisalat, KDDI, NTT DOCOMO, Ooredoo, Orange, Singtel, Telecom Italia, Telefonica, Telenor, Telstra, and Vodafone,”
but still, it has not got licensed because of some technical challenges which we will talk about later. 

In Lora low data rates are used, because of low data rates, low bandwidths are required.A variety of bandwidths are available: 7.8 kHz; 10.4 kHz; 15.6 kHz; 20.8 kHz; 31.2 kHz; 41.7 kHz; 62.5 kHz; 125 kHz; 250 kHz; 500 kHz . this bandwidth can be selected upon link condition and data rate


The Lora Network Diagram : 




Node:
The nodes are the sensing elements. Nodes to Gateway is typically a star-topology.
Communication to endpoint nodes is generally bi-directional, but it is also possible to support multicast operation, and this is useful for features such as software upgrades and the like or other mass distribution messages. Nodes can be of the following types 
  1. Class A - bi-directional end-devices
  2. Class B - bi-directional end-devices with scheduled receive slots
  3. Class C - bi-directional end-devices with maximal receive slots 


LoRa gateway :   
The gateway receives the packets from the LoRa nodes/ endpoints and then transfers them onto the network server. This part of can be Ethernet, cellular, wifi or any other telecommunications link wired or wireless. The gateways are connected to the network server using standard IP connections. In this way the data uses a standard protocol, LoRa gateways may often be co-located with a cellular base station.
Gateways within the same network require synchronization.  Communication between end devices and gateways is spread out on different frequency channels and data rates. The selection of the data rate is a trade-off between communication range and message duration.


Network Server: One of its core responsibility is to eliminate duplicate packets.The network server can manage the data rate and RF output for each end device individually by means of an adaptive data rate (ADR) scheme that is typically updated once every 24 hours


Application Server: is truly dependent upon your application 


Possible Application areas : 

·        Smart Parking
·        Environmental monitoring & Agriculture 
·        Waste management
·        Street Lightning
·        Asset tracking
·        Postpaid based Utility meters mainly water and gas meters                                              
·        Flood monitoring
·        Railway Level crossing
·       
Interesting projects around Lora:                            


The All wanted Location tracking topic: 

Geolocation is a part of the Lora Standard . and sagemcom is a company working on it.

Basically, At the physical layer, the radio signal used by LoRa is somewhat close to a radar signal, thanks to its Chirp Spread Spectrum (CSS) technology. The antenna Gateway can very precisely detect the arrival of the signal emitted from the device, it was explained by Thierry Listable.

By DTOA (difference time of arrival) technology the base station can record the time of arrival of the signal from the device and a position is calculated from that. Obviously, static position is appropriate for the case of Lora 
Semtech says resolution could be from 10m to 100m but Sagemcom says it could be more precise and they are working on a protocol named femtoLora

A company named iota tracker has already announced a product based on it
ref:

http://www.iotatracker.com/howitworks
https://www.youtube.com/watch?v=x4Ic92efLY8 


To use it you need to buy their Home base station which is actually a compact gateway, maybe they won't create the network by increasing the number of users.

LinkLabs has a  statement on this topic to https://www.link-labs.com/lora-localization/  I assume it could be a market hype only So this topic needs more study obviously.

Security of Lora Wan: 
you can listen to this talk regarding the security of Lora
https://www.youtube.com/watch?v=iZOfGGCw90M 

Lora Chip manufactures: (Node)
·        Semtech http://www.semtech.com/wireless-rf/lora.html [has a concentrator chip also (gateway)]
·        niceRf   http://www.nicerf.com/product_146_136.html [actually uses semtech chips]
semtech ships are lower in price than microchip          

Gateway:
its obvious that new technology devices cost would be very much so The Things network has come up with lora products which are comparatively low . its all open software and open hardware but its actually for development and these are based on Microchip’s Lora modules
·       similarly Froggyfactory sells development alike devices like the things network based on semtech  chips

Lora based LPWAN solution Selling Companies:  these companies are selling network services (Server + Application server) part of LoraWan
·        https://www.link-labs.com/
·        https://www.loriot.io/


      Technical challenges of Lora 
      I think the cost and hassle to build and maintain the network infrastructure is what that will prevent Lora from acquiring mass acceptance . Sigfox or NB-IOT will solve this problem as network operator it self will build & support the sub GHz infrastructure along with their 3G/4G cellular services. So now lets see what the future holds for the LPWAN market 

shared Clipboard / Shared Folder Fix in VirtualBOX VM

Are you a person who has to work on both windows and linux ? Probably you have windows running as host and linux as guest, in my case I have installed lubuntu as guest using virualBOX

Now it would be very convenient if you can copy paste text from host to guest or guest to host. The following steps will guide you through it

in my case Lubuntu is guest while running windows 10 as host
Firstly enable bidirectional mode to both drag and drop & shared clipboard at VirtualBox Manager settings
Settings>advanced 
Both shared clipboard and drag and drop should be checked














Secondly virtualbox guest additions should be running
So start your VM , In my case it is lubuntu .
1. If it is running in scaled mode. Then disable it by pressing Right CTRL(host) + C 
2. From top menu   Devices > Insert Guest additions CD image

In your Lubuntu VBOX will pop up if not open the vBox



Now create a folder in desktop “Guest-Additions” and then copy paste the contents of the vBox to it After that open terminal in this folder and run the following

$ sudo apt-get install gcc make
$ sudo ./VBoxLinuxAdditions.run
$sudo reboot

Now you can copy paste text from guest to host or host to guest

---------------------------------------------------------------------------------------------------------------
Shared Folder fix in virtual Box 

 Like before make sure vBox guest Additions is installed 
  1. Shutdown your VM os if it is running
  2. Go to settings of the VM and config the shared folder settings , give the path of the folder [host] which you want to share with the guest , here i have created vBox_shared folder in C


Now start the VM
  1. First make a folder in the /mnt directory. This folder will hold the contents of the host folder which you want to share with the guest 
  2.  Then run the vboxsf command to merge 


Now you will be able to access the folder [vBox_shared] shared by the host in your guest at /mnt/vBoxShared directory 

You have to run the command each time you login 



what is LPWAN ?

A lot of buzz nowadays around Lora, sigfox, NB-IOT and other LPWAN based technologies. this short post is about a basic introduction on the LPWAN technologies 

LPWAN means low power wide area network LPWAN technology is perfectly suited for connecting devices that need to send small amounts of data over a long range, while maintaining long battery life.

Lets see the following range vs power usage graph to see where LPWAN stands with othe communication technologies like Bluetooth , wifi , zigbee and others 



So LPWAN has the following characteristics:
  • Low power (between 5 to 10 years)
  • Range in kilometers (up to 10Km)
  • Low bit-rate: Less than 5,000 bits per second. Often only 20-256 bytes per message are            sent several times a day.
  • Clever modulation
  • Cheap

LPWAN technologies can be sub divided into the following categories:
  1. UNB
  2. (NB-iot, NB-Ciot, LTE-iot)
  3.  Lora

UNB
Cellular NB (narrowband)
Lora
Sigfox
NB-iot
Lora Alliance
Telensa
NB-Ciot
LinkLabs
Nwave
LTE-iot

eightless


Hardware Manufacturers 
Texas instruments (Sigfox)
Qualcomm
Semtech 
Atmel (Sigfox)
Intel
ST electronics (semtech licence ) 
Samsung (Sigfox)

Microchip (semtech licence ) 
Silicon labs (Sigfox)



Callgraph generation using gcc, egypt & graphviz

In this post, we will see how to use gcc, egypt & graphviz to generate call graphs of any C-based source code / multiple source codes. This technique will be helpful if you are working on legacy code and want to have a view of the code architecture at first.



Among the three tools mentioned above, GCC is generally pre-installed in Linux. So You need to install the other two. 


Follow the following :


1. Download Egypt from here egypt download and then unzip it


~/Downloads$ tar -xzvf egypt-1.10.tar.gz
~/Downloads$ sudo mv egypt-1.10 /opt


go to the egypt directory then install it by these commands


/opt/egypt-1.10$ perl Makefile.PL
/opt/egypt-1.10$ make
/opt/egypt-1.10$ sudo make install


2. then install graphViz by


$sudo apt-get install graphviz


Alright then tools are installed So now let's go to the basics 


In order to generate call graph, you basically need the following steps 


1. compile and generate object files using gcc

2. generate RTL from the object files using gcc

3. generate the call graphs using egypt & graphviz 


RTL means Register transfer Language. It is used to describe the data flow at the register transfer level. It is actually a kind of intermediate representation that is very close to assembly language. 


First of all compile and run a simple C program with an additional file 


$mkdir test
$cd test
$notepadqq hello.h
$notepadqq hello.c
$notepadqq main.c


#include <stdio.h>
#include "hello.h"

void main(int argc, char const *argv[])
{
    printf("I am the Main Function\n");
    hello_world();

}

main.c


#ifndef HELLO_H
#define HELLO_H

void hello_world(void);

#endif  

hello.h


#include <stdio.h>
#include "hello.h"

void hello_world(void)
{
    printf("hello world\n");
}

hello.c 


Now let’s compile using GCC 



$gcc -Wall main.c hello.c -o hello
$./hello


Now generate the RTL expands and run egypt command on the output to get a callgrqaph picture 


$gcc -fdump-rtl-expand main.c hello.c
$egypt main.c.192r.expand hello.c.192r.expand | dot -Grankdir=LR -Tsvg -o hello.svg


now open the svg file and you will see the pictorial call graph of the hello application that you made




ARM Cortex-M0 : Introduction

Well we designers come to a point when we want to go to the next level of embedded designing and we start to think about ARM based microcontrollers. So what is ARM ?

Actually ARM is a processor and the processor core is  sold by the company also named ARM to different vendors like STM , Texas Instruments , Atmel and so on . So these vendors do what ?
well instead of re designing the processor these compnaies make microcontrollers around the ARM processor . & we developers choose microcontroller from these vendors and start using it.

So why would all the vendors choose ARM ?

Because ARM ( advanced RISC machine) is a family of reduced instruction set computing architectures and requires less number of transistors than typical complex instructions set computing architecture s (CISC) . This approach reduces cost , power consumption and heat . for example ARM cortex M0 has 12,000 logic gates & even a 32 bit multiplication can be completed in 1 cycle. some of the important features are below:

Features: 
  • Cortex- M processors are extremely C friendly
  • increased performance and efficiency 
  • Low cost
  • extended battery life
  • floating point 
  • DSP capability 
  • Lower operating frequency means : lower active power & lower EMI

More information on  ARM cortex M processor: 
  • Remember ARM cortex M0 is a processor, Cortex M0 is designed as an ideal C target  
  • Cortex M0 has 56 instructions 
  • user can choose devices with smaller flash memory sizes for the the same application 
  • The ARM Cortex-M1 processor is the first ARM processor designed specifically for implementation in FPGAs. 
  • Cortex M0 processor is a 32 bit RISC (reduced instruction set computing) processor with Von neuman Architecture 
  • clock frequency for the cortex M0 processor can be reduced significantly to achieve lower power consumption 
  • Cortex M0 processor has implemented the ARMv6-m architecture 

Some Abbreviations:  

ASSP: Application Specific Standard products
SOC: System on chip
ARM:  originally Acorn RISC Machine , later Advanced RISC Machine
NVIC: Nested Vector Interrupt Controller
MDK: Microcontroller development Kit
AMBA: Advanced Microcontroller BUS architecture
AHB: Advanced High performane BUS
APB: Advanced peripheral Bus


Instruction sets : 

ARM cortex M processors supports 2 types of instructions sets

  • 32 bit instruction set ----------- called ARM instruction set 
  • 16 bit instruction set ----------- called Thumb instruction set 
for example ARM7TDMI supports both types of instruction sets 

Most instructions generated by the C compiler use the 16 bit instructions & 32 bit instructions are used when the 16-bit version cannot carry out the required operations. 



Interrupt types: 

Maskable Interrupt: The interrupts which can be ignored by the processor 

NMI(Non maskable interrupt): the interrupts that can not be ignored by the processor



Cortex M0 block diagram: 


Processor Core elements :

  • Register Banks
  • ALU(arithmetic logic unit)
  • Control Logic 


AHB Lite Bus interface: is a on chip bus protocol used in many ARM processor . it is part of the AMBA ( Advanced Microcontroller BUS architecture) specification . it is 32 bits wide .




  • APB means Advanced Peripheral Bus and you can see peripherals are attched with this BUS 
  • AHB Lite supports 32,16,8 bit transfers
Unlike AHB lite APB does not support different sized transfers So APB should be accessed using word sized transfers 


                                           In ARM Word is 32 bits wide 

Categories

Pages

Firmware Engineer

My photo
Works on Firmware, Embedded Linux, Smart Metering, RTOS, IoT backend

Contact Form

Name

Email *

Message *

Copyrighted by Hassin. Powered by Blogger.