Jan 242015
 

Lets start with a definition of the MBR :
A Master Boot Record (MBR) is a special type of boot sector at the very beginning of partitioned computer
mass storage devices. The MBR holds the information on how the logical partitions, containing file
systems, are organized on that medium.
Besides that, the MBR contains executable code to function as an operating system-independent chain boot loader in conjunction with each partition’s Volume Boot Record.

To make simpler, if a disk is a book, the mbr is the index table to quickly jump to each partitions.
MBR and GPT are just 2 different ways of writing that index (GPT handles a higher number of partitions and also bigger partitions).

So how to convert a GPT disk to MBR?

1.Write down the offset and length of your partition(s)

2.Delete the disk layout (this will not delete any datas, « only » the partition table and boot loader if any)

3.Create Disk (MBR style)


4.Create partition(s) with correct offset (most important) and length. Note that you can always correct these later by editing the MBR (advanced tools).
Choose IFS for a NTFS filesystem, or FAT32.


You end up with a MBR disk with a partition table similar to the GPT you previously had.
Note that you may want to inject a boot loader (nt6, g4d, etc) if this disk is a boot system one.
Also, this operation works the other way : MBR to GPT.

 Posted by at 19 h 20 min
Déc 242014
 

In a previous article, I have use an attiny85 + ds18b20 + rf433 to built a cheap temperature probe.

This time, I needed the humidity next to the temperature.
I then decided to use a dht11 (you can get it starting at 1.50€ on ebay).
Total cost is below 4€.

Here below the wiring.

tx_dht11_bb

Here rf433_sendOOK_at85_dht11 the arduino sketch (rename the txt file to ino).
You will also need this dht11 library.

Here some pictures. Notice that i used an old (but still good for my purpose) smartphone 3.7v battery.

IMG_4868

IMG_4865

IMG_4864

Nov 092014
 

I found a small microphone unused in some old box.
I decided I could play with it by plugging it to my arduino.
Was rather easy using the analogread function but it was lacking sensitivity.

Googling around it appeared I needed an op-amp. For less than 2 euros, I could get a 10 pieces batch on ebay.

See below the schematic.
Notice the voltage divider (r3 to 5v, r2 to gnd) to get a 2.5v voltage (5v / 2) : this way, you should read about 512 (1024 / 2) on the analog port when the microphone is off.
Notice the gain as well (r5/r4) which should give me about x75 gain (r5/r4*vin).

lm358_2

The Arduino sketch is rather simple : it will trigger a led when the reading goes about a certain value (that will depend on your mic and r0).

const int analogInPin = A0;  
const int ledPin=13;
int sensorValue = 0;        

void setup() {
  Serial.begin(38400); 
  pinMode(ledPin, OUTPUT); 
}

void loop() {
  digitalWrite(ledPin, LOW);
  sensorValue = analogRead(analogInPin);            
  if (sensorValue>640 || sensorValue<580) {
  Serial.print("sensor = " );                       
  Serial.println(sensorValue);   
  digitalWrite(ledPin, HIGH);  
  delay(50);
  }
  delay(50);                     
}
 Posted by at 16 h 56 min  Tagged with:
Oct 182014
 

In a previous article, we had use an Arduino + RF433 chip + DS28B20 to come up with a cheap temperature sensor.

We are going to improve the setup by replacing the Arduino Pro mini by an ATTINY85.
See here on how to flash an ATTINY85.

See rf433_sendOOK_at85 for the code.

Note that power consumption will be as low as 0.005ma (5ua) with a peak at 18ma when reading temp.

See below a revised wiring replacing the Arduino by an ATTINY85.

tx_ds18b20_v3_bb

 

 Posted by at 17 h 42 min
Oct 182014
 

In previous article, I made a cheap temperature probe using an arduino pro mini.

Still, the arduino pro mini is a bit overkill and i would like to keep it for prototyping my projects, not on « live » projects.

So lets have a look at the attiny85 :
-it is cheap (1€ a piece)
-runs at 8mhz
-has 8k programmable memory
-has very low power consumption

Sounds perfect for my needs !

Lets have a look at the pinout.

attiny45_85pinout

To flash this baby, I decided to use my arduino uno r3.
See below a quick how to.

1- unzip attiny under Documents\Arduino\hardware (you should end up with a folder attiny in there)
2- start the arduino ide and upload the arduinoisp sketch (in the arduino examples) to your « arduino uno r3 » board
3- choose « arduino as isp » under tools\programmer menu
4- choose « attiny85 (8mhz) » under tools\board
5- upload your sketch onto the attiny85

Lets see how to wire our attiny85 to your arduino.

flash_attiny85_bb

In a next article, we will see how to adapt this article for attiny85.

Hint : if you are getting the error « relocation truncated to fit », have a look here (and see to replace your ld.exe).

 Posted by at 13 h 46 min
Oct 062014
 

My little project this last week end.

I need to add a few rf433 oregon temperature sensors to be linked to my rfxcom + jeedom domotic box.
Unfortunately, these sensors (oregon THGR122N) are about 25€ (or 15€ using a cresta clone), not including shiping costs.

Therefore I decided to do a cheap one myself using :
-an arduino pro mini (2.50€)
-a fs1000a transmitter (1.50€)
-a ds18b20 (1€)

The whole thing uses less than 2ma when sleeping, and max 20ma when it reads temperature from the ds18b20.

Here comes the sketch rf433_sendOOK.
Note that that I am re using code from connectingstuff.net to send oregon 2.1 compatible packets.

Possible evolution would be to replace the arduino pro mini by an ATTINY85.

arduino_oregon

Here comes the wiring.

tx_ds18b20_v2_bb

 Posted by at 22 h 21 min
Sep 282014
 

In previous article, we managed to decode a RF433 packet using homeeasy protocol (a di-o chacon telco for a power outlet).

Next obvious step is now to replay it using our Arduino and a FS1000a rf433 chip.

Here below the arduino sketch.
(wiring is simple : data to digital 3, gnd to gnd, vcc to 3.3v)

const int transmit_pin = 3;

void setup()
{
   pinMode(transmit_pin, OUTPUT);
    Serial.begin(115200);	// Debugging only
    Serial.println("setup");
}

void loop()
{
  //time to adjust
  digitalWrite(transmit_pin, LOW);
  delayMicroseconds(5000);
  //preamble
  digitalWrite(transmit_pin, HIGH);
  delayMicroseconds(275);
  digitalWrite(transmit_pin, LOW);
  delayMicroseconds(2800);
  //datas - a manchester encoded string, sniffed with sdrsharp
char binary[]={0,1,0,1,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,1,0,0,1,0,1,0,1,0,1};
for (int i=0; i <64; i++){
      if (binary[i]==0) {
        digitalWrite(transmit_pin, HIGH);
        delayMicroseconds(275);
        digitalWrite(transmit_pin, LOW);
        delayMicroseconds(275);
      }
      if (binary[i]==1) {
        digitalWrite(transmit_pin, HIGH);
        delayMicroseconds(275);
        digitalWrite(transmit_pin, LOW);
        delayMicroseconds(1225);
      }
   } 
   //the end
   digitalWrite(transmit_pin, HIGH);
   delayMicroseconds(275);
   digitalWrite(transmit_pin, LOW);
  delayMicroseconds(5000);
  //
delay(1000);      
  }

Here below the generated signal which as you can see is very similar to the original one.

rf433_arduino

The original

rf433_Audacity2

Sep 282014
 

Arduino : use a nokia 5110 lcd screen
Arduino : use a SD Card Reader
Arduino : a laser tag and a photo resistor
Arduino : play with a CC1101
Arduino : play with a potentiometer
Arduino : use a transistor
Arduino : use a shift register (74HC595)
Arduino : use a shift register (74HC595) and a transistor array (ULN2803)
Arduino : shift out leds
Arduino : Cascade two 74HC595
Arduino : Cascade two 74HC595 (video)
Arduino : 4 digits 7-led display

Previous recap #1

Arduino : display a clock based on a lcd screen and a RTC
Arduino : output to a tv (tvout)
Arduino : use a PS2 keyboard
Arduino : send and receive data thru radio frequency (RF433)
Arduino : programming an Arduino Pro Mini with an USB TTL Dongle
Arduino : use an ethernet controller (enc28j60)
Arduino : use it as an infrared remote
Arduino : use a Texas CC1101
Arduino : use your internal atmel 328p temperature

 Posted by at 13 h 24 min
Sep 262014
 

In previous article, thanks to a R820T tuner, we managed to capture some RF4333 signal (which seems to be repeated 5 times).

rf433_Audacity

Zooming in one pattern, we can see high and low bits.

rf433_Audacity2

Googling around, it appears that my di-o chacon telco is using the homeeasy protocol.
a preamble (before data) is HIGH for 275us and a LOW for 2675us.
a 0 is HIGH for 275us and LOW for 275us.
a 1 is HIGH for 275us and LOW for 1225us.

We therefore end up with 64 bits (wired):
01 01 01 10 10 10 01 10 01 10 01 01 10 01 01 10 10 10 10 01 10 10 10 10 10 01 01 10 01 01 01 01.

Still reading the homeeasy protocol, we learn than 01=0 and 10=1 (manchester encoding).

The result is (32 bits, decoded) :
00011101010010011110111110010000

Bit 0 to 25 is the device id : 11101010010011110111110 -> 7527BE
Bit 26 is the flag group : 0
Bit 27 is on/off : 1
Bit 28 to 31 is the device code : 0000

Now re using this article, we should be able to replay that signal with the right timings.

Sep 212014
 

I got myself a cheap 4 digits 7-led display and I thought I would spend a few mns playing with it and documenting it.

4digits

 

12 pins : 8 for the segments (including the dots), 4 for each digit
Top row : 1, a, f, 2, 3, b
Bottomw row: e, d, dp, c, g, 4

I decided to use the Sevseg arduino library.
More about this library here.

The wiring is then as is :

Arduino pins -> 4digits display pins
2->1
6->a
11->f
3->2
4->3
7->b
10->e
9->d
13->dp
8->c
12->g
5->4

Below the schema

4digits_bb

Note that this is a lot of digital IO’s used. A future article could focus on reducing the number of IO’s needed.
Below the arduino sketch (from the example provided with the sevseg library)

/*Written by Dean Reading, 2012.  deanreading@hotmail.com
 
 This example is a centi-second counter to demonstrate the
 use of my SevSeg library.
 */

#include "SevSeg.h"

//Create an instance of the object.
SevSeg sevseg;

//Create global variables
unsigned long timer;
int CentSec=0;

void setup() {
  //I am using a common anode display, with the digit pins connected
  //from 2-5 and the segment pins connected from 6-13
  sevseg.Begin(1,2,3,4,5,6,7,8,9,10,11,12,13);
  //Set the desired brightness (0 to 100);
  sevseg.Brightness(50);

  timer=millis();
}

void loop() {
  //Produce an output on the display
  sevseg.PrintOutput();

  //Check if 10ms has elapsed
  unsigned long mils=millis();
  if (mils-timer>=10) {
    timer=mils;
    CentSec++;
    if (CentSec==10000) { // Reset to 0 after counting for 100 seconds.
      CentSec=0;
    }
    //Update the number to be displayed, with a decimal
    //place in the correct position.
    sevseg.NewNum(CentSec,(byte) 2);
  }
}
 Posted by at 18 h 08 min