All posts by Cale

Q.C LITE SETUP

#45 OLD MDVR SETUP (2015)

How to set up MDVR

  • Open the box and separate the MDVR from the cable box. Next inspect the MDVR device for any form of damage. Then inspect the contents of the cable box… make sure all the cables are there. the box  consists of: 1x GPS module, 1x 3G antenna, 1x WIFI antenna, 4x camera cables, 1x power cable with 10A fuse in it, 1x USB 2.0 cable, 1x screen cable, 2x keys with 1 spare fuse in a sealed packet.
  • Next place the MDVR on a stable table, open the device lock and slide the HD out, next place a SIM card and a SD card in the open sockets. Take the HD and connect it to a PC, make sure that the HD is working then copy/paste the necessary param.xml file on to the root dir. of the HD. Now take the HD and place it securely into the MDVR and lock the MDVR again
  • Now connect the screen cable to the front of the MDVR, connect the GPS, 3G and the power cable to the back of the MDVR. Wait for the device to power up then login, move to system setup > terminal. Then insert the device number into the device id field and into the phone number field. Next move to Tools > Parameters > Parameters Import and select OK… Make sure the device outputs IMPORT SUCCESS. Also make sure that you run the command without the SD card in the MDVR and in some instances the HD may have to be formatted first then the PARAM file copied over and imported on the device. The device will now restart.
  • Plug each camera cable into the back of the MDVR, test each cable by applying pressure to the full length of the cable through your hands. Test each of the 4 sockets as well. Now open RMVS ( 視頻應用 ) and make sure the device is reporting online. Test the cameras by double clicking on the online vehicle. Next click Playback > Record and then click “search” ensure that the graph shows a green line. Don’t worry if it’s thin. Also check that the device is recording to the HD and SD properly. You can do this by selecting the device no. > click on playback > click on record > click on search. Select the file tab on the bottom of the page. Ensure that there is a 999mb file and that the SD an HD record times are the same (There might be a few second missing but that is ok) If there is no 999mb file or there is a 1999mb file, both the HD and the SD card must be formatted and then check again to make sure that those files are there.

Also don’t forget to set the report interval for the devices. To do this right click on a device > click on GPS Reports Intervals and set the time to 120s.

MDVR Firmware & BIOS

  • To update the FIRMWARE of the MDVR device——-> Put the device on, Open RMVS program use technical user, ensure that the device SIM has data and is reporting on the RMVS program. Next copy the entire contents of FTPfirmware.txt file into (right click online device > parameter config > custom) paste into input. Restart the device if necessary. You should see UPDATEING
  • To update the BIOS of the MDVR device——–> Put the device on, Open the RMVS program use technical user, ensure that the device SIM has data and is reporting. Next copy the entire contents of BIOS.txt into (right click online device > parameter config > custom) paste into input. Restart the device if necessary. You should see UPDATEING on the screen

When new stock arrives always check it for faults first

Hard drives

How to Format New HDD

-Go to Computer Management > Initiate the HDD.

-Shrink the HDD to 494MB and 931.51GB NTFS. 

-Open GUI FORMAT select drives and format.                                                       

-Insert the HDD into the Device

{Download from http://www.realmodscene.com/index.php?/topic/323-gui-format-fat32-drive-formatter/}

Opening a device

When opening a device first wash hands and make sure you have all the correct tools. Allen key, screw driver, socket key, & white silicone. Make sure you work in a non-static area.

Open the 12 outer screws with the correct size Allen key. Lift the top part of the cover up carefully. Remove the forward and back panel carefully. Remove the flexi cable and the lock cable from the motherboard. Remove the three antenna cables from their sockets on the device.

Carefully unscrew the daughterboard from the motherboard. There should be 4 screws. Remove the flexi cable connected to the LED lights board. Now unscrew the 2 bronze colored screws with the socket tool. Unscrew the remaining screws with the screwdriver. Take the motherboard out and replace with a new one.

ARM DEV BOARD STM32 MCU

#43 STM32 MCU ( BLUE PILL )

The STM32 F103C8T6  (AKA BLUE PILL) Is a great development board to upgrade to from the Arduino series. The STM32 platform is a massive powerhouse that can handle complex calculations extremely quickly. Examples such as quadcopter’s, robotics etc.

FEATURES

  • On-board Mini USB interface, you can give the board power supply and USB communication.
  • On-board test indicator LED
  • On-board reset button and power indicator LED
  • On-board 100ma 3.3V Regulator
  • All GPIO are led out and the names of the pins are marked
  • After soldering the headers, you can directly plug the board onto the breadboard

TECHNICAL SPECIFICATIONS

  • CPU Part Number: STM32F103C8T6
  • Core: ARM 32 Cortex-M3 CPU.
  • Debug mode: SWD (can be programmed with ST-LINK V2)
  • CPU Internal Maximum Clock : 72MHz
  • External Clock Source: 8MHz crystal
  • 64K flash memory, 20K SRAM
  • 2.0-3.6V power, I/O
  • Reset(POR/PDR)
  • Size:5.3cm x 2.2cm

Useful links can be found here

PRO MINI FARM ALARM V1.0

#42 PRO MINI FARM ALARM V1.0 BREADBOARD

The Pro Mini V1.0 testing for the Farm Alarm

The Pro Mini has proven to be a suitable solution. The board is very small and has more than enough specs to control the GSM/GPRS module while also sending data to a remote server via TCP.

The Pro Mini requires an FTDI programmer since there is no USB port on the board.

FTDI programmers pin out relative to the Pro Mini
Pro Mini ( ATMEL MEGA328P MU1039 )

FAILED ATTINY85 EXAMPLE

#41 A FAILED ATTINY85 EXAMPLE (GSM/GPRS)

A quick solder up to test the circuit (had issues with power sharing between GSM module and ATTINY85)

My first attempt to build a small circuit which controls a relay to an alarm speaker was a failure. Contrary to popular belief failure in electronics projects is quite common and I would argue that it is of paramount need if you want to learn anything.

Surprisingly my failure was in using the ATTINY85 instead a Pro Mini, Uno or Mega. Some problems I had were:

  • Not enough RAM to hold all my variables (I had to scrounge 😢)
  • Very limited FLASH memory.
  • GSM module interferes with the ATTINY’s 5v power source when connected using the same source with no filtering.

In a later project I created a reliably working solution with the Pro Mini as the brains.

My goal was to create a small circuit which uses the ATTINY85 as the brains. It uses the A6-GSM-Module to receive SMS’s, phone calls and sends TCP data. Finally it has a 5v relay which will switch on/off an alarm speaker. The theory is that when I’m on the farm in the fields and not near the house, I have the option of remotely starting an audio alarm at will. This should be a deterrent to potential criminals.

I made an easier to debug testing circuit with exposed copper traces (Same issues)

After making an easier to debug circuit I tried to get the ATTINY85 to work happily with the GSM module. This was going to be a bit complicated and I suspect I would have to isolate power between the ATTINY85 and the GSM module. This would require more components and the board is already looking cramped. A much easier solution is to use the Pro Mini instead of the ATTINY85.

The Pro Mini is most certainly a beauty.

DIGISPARK REV3 ATTINY85

#39 DIGISPARK REV3 ATTINY85 DEV BOARD

The Digispark rev3 USB board is an ATtiny85 based microcontroller development board. It comes with a USB interface. Coding is similar to Arduino, and it makes use of the familiar Arduino IDE for development.

BOARD SPECS

  • Support Arduino IDE 1.0+ (OSX/Win/Linux)
  • Can be powered by USB or 5v or 7-15v (automatic matching) extra power supply
  • There is a 500ma 5V regulator on the motherboard.
  • USB embedding (serial debugging)
  • 6 I/O Pins (2 for USB support)
  • 8k Flash Memory (about 6k after bootloader)
  • I2C and SPI (vis USI)
  • PWM on 3 pins (more possible with Software PWM)
  • ADC on 4 pins
  • Power LED and Test/Status LED (in Pin0)

The smallest USB Arduino

PDF Manual

UNO ATTINY85 PROGRAMMER

#38 DIY ARDUINO UNO ATTINY85 PROGRAMMER

Sometimes an Arduino pro mini is just not small enough for an electronics project. Enter the Arduino ATTINY85, this MCU comes in an extremely small package. It has only 8 pins and works with 5v.

Below are the specs of this microcontroller:

  • AVR MCU, 8K FLASH, 512B RAM, SPI
  • Controller Family/Series:AVR Tiny
  • Core Size:8bit
  • No. of I/O’s:6
  • Program Memory Size:8KB
  • EEPROM Memory Size:512Byte
  • RAM Memory Size:512Byte
  • CPU Speed: 8/16 MHz internal clock, up to 20MHz external clock
  • No. of Timers:2
  • Peripherals:ADC, Comparator
  • No. of PWM Channels:4
  • Digital IC Case Style:DIP
  • Supply Voltage Range:2.7V to 5.5V
  • Operating Temperature Range:-40°C to +85°C
  • No. of Pins:8

This is great and all but its a hassle to program the board unless you buy a dedicated programmer (expensive in SA) or if you’re happy to use a messy breadboard every time you want to program. So I decided to make a very crude but effective programming shield for my Arduino UNO.

VARS, DECLARING CONSTANTS

#37 Using Variables, Declaring Constants

Variables are tools which help programmers temporarily store data for a certain amount of time. Constants are tools which help programmers to define artifacts that are not allowed to change or make changes.

To understand variables we have to first take a look at memory addressing in brief. All computers contain a MCU and a certain amount of temporary memory called RAM In addition may devices also contains a permanent storage memory called ROM. The MCU executes the program and in doing so it utilizes the RAM to fetch binary code to be executed as well as the data associated with it.

RAM uses addresses which allow us to point to blocks of memory stored within itself.

When programming in C++ we define variables to store those variables. Below are two examples:

VariableType VariableName;
e.g int number;

VariableType VariableName = InitialValue;
e.g int number = 0;

The variable type attribute tells the compiler the nature of data the variable can store.

Below is an example of declaring and initializing multiple variables of a type.

int first = 0, second = 1, result = 16;

Data stored in variables is stored in RAM. This data will be lost once the application terminates unless the program is told to save the data to a storage medium such as a hard disk.

If variables are declared outside the scope of the function function() instead of with in it, these variables will be considered global variables.

Variable types:
bool
char
unsigned short int
short int
unsigned long int
long int
unsigned long long
long long
int(16 bit)
int(32 bit)
unsigned int(16 bit)
unsigned int(32 bit)
float
double

C++ allows us to substitute variable types to something that the programmer may find a bit more convenient . The keyword typedef can be used for this functionality. Below is an example where the programmer wants to call an unsigned int a descriptive STRICTLY_POSITIVE_INTEGER.

typedef unsigned int STRICTLY_POSITIVE_INTEGER;
STRICTLY_POSITIVE_INTEGER exampleNumber = 6570;

Constants are like variables in C++ except their value can’t be changed. Constants also occupy space in memory just like variables however this space cannot be overwritten.

Constants in C++ can be:

  • Literal constants.
  • Declared constants using the const keyword.
  • Constant expressions using the constexpr keyword.
  • Enumerated constants using the enum keyword.
  • Defined constants that are not recommended and deprecated.

Enumerations comprise a set of constants called enumerators. This is used when you need a type of variable whose values are restricted to a certain set defined by the programmer..

Below is an example of using Enumerations:

#include <iostream>
using namespace std;

enum RainbowColors
{
Violet = 0,
Indigo,
Blue,
Green,
Yellow,
Orange,
Red
};

int main()
{
  RainbowColors Color = Blue;
  cout << Color << endl;
  return 0;
}

Defining constants using #define
#define pi 3.14
#define is a preprocessor macro. So once defined all mentions of pi henceforth will be replaced by 3.14 This is a text replacement.

ANATOMY OF A C++ PROGRAM

#36 ANATOMY OF A C++ PROGRAM

C++ programs are organised into classes comprising of member functions and member variables. A simple HelloWorld.cpp like below can be classified into two parts: the preprocessor directives which start with # and the main program that starts with int main()

#include <iostream>

int main()
{
    std::cout << "Hello World" << std::endl;
    return 0;
}

A preprocessor is a tool that runs before the actual compilation starts. Preprocessor directives are commands to the preprocessor that always start with the # symbol. A custom header created by the programmer will be encapsulated by quotes "..." instead of brackets <...> which are typically used when including standard headers.

Custom: #include "...relative path to file\file.h"

Typical: #include <file.h>

After the preprocessor directive(s) is the body of the program characterized by the function main(). It’s a standard convention that function main() is declared with an int preceding it. int is the return value type.

Functions in C++ need to return a value unless specifically specified otherwise. In main() an int is always returned since it is indeed a function. This is very useful since it provides the ability to query on the returned value of the application. A typical success return value is 0 and in the event of an error -1 is returned.

Namespaces are names given to parts of code in order to reduce naming conflicts. By invoking std::cout, you are telling the compiler to use that one unique cout that is available in the std namespace.

C++ has two comment styles:


// indicates the start of a line and is valid to the end of that line.


/* followed by */ indicates the contained text is a comment.

Functions enable you to divide the content of your application into functional units that can be invoked in a sequence of your choosing. In a C++ console application main() is the starting function of your application.

Example of using functions in C++:

#include <iostream>
using namespace std;

//Declare the functions
int Demo_1();
int Demo_2();

int main()
{
    Demo();
    Print();
    return 0;
}

int Demo_1()
{
    //subtraction
    int x = 8;
    int y = 6;
    cout << x-y << endl;
    return 0;
}

int Demo_2()
{
    //addition
    int x = 8;
    int y = 6;
    cout << x+y << endl;
    return 0;
}