Wednesday, September 9, 2020

My Initial Project Idea: Personal Real-time Location System

 It was by accident that I got into drones lately. I hade 3 tiny drones in the past(the unbranded Chinese drones sold at SM Toy Kingdom) but my curiosity was killed by these drones because it did not meet my expectations. 2 Months ago, I got to noticed the DJI store at Sm North Edsa and got me a small drone(tello). Before I purchased it, I usually ask these questions so that I will have an idea what's it capable of:

1. Can it balance on its own without me exerting much effort to make fly and not crash immediately?

2. Will it hover just like the toy in the movie "flubber"?

3. Can I do some programming to enable to perform certain task on it own? ("flight mission").

The seller at the DJI store said yes to all of my questions so I requested a demo and he did grant my request and it seems that 1 and 2 questions as my deal breaker was fully met and demo'ed so without any hesitation, I purchased it.

I only got to fly the tello inside the tiny room I am renting 1 to 3 times every week and watching youtube videos and researching on what are the possibilities I can do with it. 

As my knowledge increased in droning, I realized that the tello is indeed so tiny and not only that, it lacks the most basic features I need to develop a certain system just to jumpstart my learning curve on the subject matter.

I came up with an idea that the drone should be able to perform a flight mission twice a day to collect data and store this data and as data accumulates, i will search for patterns that can not be seen by naked the eye but it is there(data mining).

This is my initial thougths on this project. Will add more information soon. Part of it is face recognition, optical character recognition, extensive use of google maps and on the hardware side, I would initially be needing an arduino or raspberry pi, battery charge level sensing to automatically turn off the power when the battery is fully charge and a custom drone charging station because the idea behind this is that this whole system will be operated in a remote location.

And certainly tello can not be used for this purpose so last week, I bought the dji mini. It is still a tiny drone but it can already meet my project's initial specification. 

Friday, April 12, 2019

A very good example of Contractual Employment Case

Contractual employment is ok for short term employment but when it is renewed several times, that's when things changes and violation of employer can occur. Contractual employment is a threat to economic stability for obvious reasons. And when an employer keeps on renewing but do not offer regular employment, that employer is a scammer. Still in the IT industry, a lot of these agencies offers contractual employment because they are being paid by a bigger scammer, the scammer who only want to enrich themselves by amassing a lot of revenues derived from the works of programmers. These agencies may not aware of the these facts or they are aware but not scared because they know someone which is obvious from the case outcome I filed.

A good example is the case of FUJI TELEVISION NETWORK, INC vs ARLENE S. ESPIRITU. you may view the details of the case here. The power to control which is essential in the 4 fold test of employee-employer relationship include to employer's power to deduct absences from salary or any other forms like in this case of fuji:
Fuji has just affirmed that Arlene was their regular employee. This is the same in my case, if I am late, agency will deduct each minute of late and I have no-work, no-pay arrangement no benefits whatsoever.. Agency controlled how they will pay me and I have no bargaining rights. Arlene had bargaining rights, she can demand that her salary be increased every time they renewed her contract. Her contract is being renewed on a yearly basis. My contract is being renewed every thee months. Arlene enjoyed a lot of economic benefits and still she won the case, she even won her case at the NLRC when she filed her first MR(Motion for Reconsideration). Fuji does no deny they don't have employee-employer relationship which is obvious in the screenshot above, but my agency deny it, and NLRC obviously affirmed it but the Court of Appeals reversed it.

I wont give any conclusion, this is just my analysis and opinion. I hope and pray the people who handle my case will see the case of Arlene and compare it to mine. My case is a lot worse than hers and yet she won.

Tuesday, February 5, 2019

Should the Contract be Dictated By One Party?

I was applying for a job(the job posting was in jobstreet a website for job seekers not contractors) and during the interview, the interviewer asked me if I could accept project based position(why would she initiate this? I would assume their job posting was a scam because they were looking for contractors not employees.), I was desperate to find a job because I had no money so I said yes but if I had money I could have replied if terms of the contract is acceptable to both parties then why not. This is already a habit of the agencies/IT companies to offer project based positions when the advertisement did not mentioned it. Legitimate Programming jobs is history because it is being blocked by these agencies/IT companies. And because of this, programmers are of the same ranks with janitors. To restore the prestige enjoyed by being a programmer is to eliminate the existence of thises agencies. Purging must start immediately. PROGRAMMERS help in the improvement of operational efficiency and reduction of operational cost. Processes that were used to take several days (and 24hours of operation) to finish can already be done in a few minutes. And with the introduction of SAP, all processes within a huge corporation can already be certified as highly accurate and because of this, more investors are willing to pour in their capital because of these trustworhy operational processes.

In order for an IT company to be recognized as IT company should develop it's own products not just because it has clients who asked them to create such a product. Companies that develop products on a contract basis provides unstable and unsecure job opportunities. A third world country like the Philippines should discourage or ban these companies from operating in the country. If you try to search jobstreet, companies like these are all over some like company with accentuation even have like 30 to 40 ads for the same position not to mention the other companies offering the same position and their client is company of accents. And most applicants came also from this company of accentuation. Or the company that started from a garage and the striped blue who's managers passes on full photo-copied versions of books. A legitimate IT company is like Microdoft,  SAP, Oracle.

Let's go back to the first topic...I had observed that saying yes immediately can have catastrophic effects. Companies are abusive and always takes advantage of the situation. So for the past 6 months, when a prospective recruiter calls me, I immefiately ask them if their client is an agency or end user. For me, knowing this fact could immefiately determine the scamming schemes of this  IT comanies/agencies.

Here are my plans if ever I am offered a contractual position and both agreed that the terms of contract are acceptable to both parties:
1) The contract price for short term engagements is Php1M. Why? This is to dicourage these scammers from proceeding with their evil plans.

2) If they agreed on the first condition, my next term is that a security and non refundable deposit should be immediately paid which is equal to a of minimum 50% of contract price. This should discourage the scammer from offering fake job openings. I had experienced several times that I would discover that upon accepting the job offer, and reporting on the first day,  there is really no job opening, they just want to waste my time. This is even not the worst, I heard that others after being trained , they will be informed that the project was cancelled.

3) If the prospective client agreed on the 1st and 2nd conditions, my third term is client should pay double during idle times. And should there be idle times for 3 consecutive days should be considered breach of contract and therefore client should pay the ramaining unpaid contract price plus 50% penalty.

And if client still agrees with this, then it is time to scrutinize the educational background, track record, ask gor sample outputs such as sample technical documentation.These are important, because my last client had these teams that were having 90%  inaccuracy suggesting that it was a scam. The manager even keeps on saying he is not contented with the output but he did counted how many revisions he asked me, he did not counted how may errors he had. And one team member would change critical settings without informing me which results in a lot of errors. I am quite puzzled because during the early stages, he would inform everyone that he had finished his part and advices me to proceed. So he knows the the consequences of his actions if he makes changes without my knowledge. Not to mention the gay local manager who is in the loop of email exchanges does not even do anything, it is either he is an illiterate or a puppet of the scammers. It was really a rediculous project and should have reported the incidence to proper authorities but decided not to but should I encounter a similar situation, I really should do it to get rid of such evil elements and prevent them from victimizing poor prople like me.

Sunday, October 21, 2018

Busy Sunday with Sparkfun's nRf52832 Dev Board

My Sunday(Oct 21, 2018) has been so so so busy because of my beacon experiment. Actually for 2 weeks now, I was stuck at why my battery charge level monitoring circuit would not work(I was just toggling between the board's A4 and A5 analog pins). And I gave up on it and went on to do another task to make the piezo speaker work with the board. I faced another very challenging task why it does not work with digital pin 10, then I remembered previously when experimented with the LED on/off sketch and I used digital pin 15 and it worked, so I transferred the connection to that pin and it worked very well. Because of this I realized that maybe the analog pins A4 and A5 are made for a different purpose so I tried to experiment with A6 and finally, I am getting good results. So, I am able to make both work.

With this success, I prepared a simple sketch that will broadcast Ibeacon, will communicate with the pc to continuously transmit battery charge level(2V up tp 4.2V)  and add GATT Services to get the battery charge level and be able to turn on / off the piezo speaker. So sad that the nRF52832 Dev Board is not compatible with Arduino's Tone library, I am not able to upload the Super Mario Brothers theme music into it.

Creating the program(sketch) is the most critical part because the battery life depends on it, so the sketch must be highly optimized to save power and battery will at least last longer than 1 day. The sketch I created is not the best solution, there are better ways to do it to make it conserve energy and the 800mAH battery could last longer than 3 months. The piezo speaker can consume more than 50mA alone, while connecting to the device would consume 30mAnot to mention the builtin voltage regulator has a normal current leakage of 10 mA and of course the red LED connected to the power source normall consumes 16-18 mA(but this can be disconnected easily as sparkfun provided the connection at the back), at normal operation it(the nRf52832 ic alone) normally consumes around 7mA. I heard that other sketches can lower the normal consumption to 0.3mA or even down to 1microA that should be enough to make it last for several days by putting the device at deep sleep. The sketch I created would only let the device enter the low power mode. I have not tried to make it enter into deep sleep mode because the last time I tried it, the nRF connect app could not connect to it. Maybe there is a technique to make it not to interfere with the connection process.

To be honest, the connection is very stable, it does not disconnect making it ideal as a key finder.

Here is the hardware setup:

My actual device on a breadboard:


With this current configuration, I can charge the battery while programming it. 

Sample Serial Output:

The nRF Connect App Screen:


Here is the screen recording:(you can hear the actual beeping of the beacon:



And finally the sketch:
You may download the sketch here.

Monday, September 24, 2018

Key Fields or Index Fields in a Data Base Table

Key Fields or Index Fields are quite useful in a database table. They were meant to have permanent or fixed values throughout their record lifetime not until the record is deleted. Key Fields makes sure that every record unique. Aside from this the database is equipped with logic(search algorithm) which makes use of index fields to perform fast and efficient search and sorting functions. I remember at one point in my programmer career when still software I am supporting is still struggling to make a name in he industry, one of the the client's problem was the program was running extremely slow so I investigated and found out that several select statements were not using index fields in there search parameter. I am aware that the software is capable of creating customized indexes so I created customized indexes and the result was 80% faster.

With this basic idea of database concepts, programmers will be able to create a group of tables that are optimized in terms query and sorting speeds. It is a fundamental concept that should not be forgotten. Always remember that if a field is meant to be modified, do not use as index field. It is a mortal sin to do it. Everybody will lough at you.

What happens when it is unavoidable because there is a possibility that all key fields are the same except that modifiable field? The answer is record will not be saved in the database. That's when a serial number as key field will come to the rescue. It makes sure that every record entered in the table is unique. It is just a design tip.

Just expressing my thought, duhhh!!!

Monday, July 30, 2018

Make Sparkfun's nrf52832 IOT Board an Ibeacon

Like I said, the nrf52832 breakout board can be programmed to become an Ibeacon using the blepheripheral library, in fact it has a sample sketch. But I think the sample sketch is not applicable to what I am trying to achieve so, I decided not to use the sample sketch. The main reason is that it needs an interrupt and a timer just to change the frame from ibeacon to eddystone, so it is not good.

But, using the included ibeacon library as guide, it enabled me to understand how to turn the device into ibeacon. I used Ibeacon Detector app to capture the data packets or advertising packets, and used the captured data to change the blepheripheral manufurerdata and that's it. I just turned it into ibeacon.

Here is the sample ibeacon advertising packet:


This is the manufacturerdata I used:
0x4c, 0x00, 0x02, 0x15, 0xa1, 0x96, 0xc8, 0x76, 0xde, 0x8c, 0x4c, 0x47, 0xab, 0x5a, 0xd7, 0xaf, 0xd5, 0xae, 0x71, 0x27, 0x00, 0x12, 0x00, 0x25, 0xcb, 0x5c

The breakdown is as follows:
0x4c 0x00 = Apple Company
0x02 0x15 = Ibeacon Identifier
0xa1 0x96 0xc8 0x76 0xde 0x8c 0x4c 0x47 0xab 0x5a 0xd7 0xaf 0xd5 0xae 0x71 0x27 =UUID
0x00 0x12 = Major
0x00 0x25 = Minor
0xcb 0x5c = Transmitted Power(-53dBm)

Here is the complete sketch:
#include <SPI.h>
#include <BLEPeripheral.h>

const char * localName  = "LED On"; 
BLEPeripheral blePeriph();

void setup() {
  // put your setup code here, to run once:
Serial.begin(115200);
  blePeriph.setDeviceName(localName);
  blePeriph.setLocalName(localName);
  blePeriph.setTxPower(measuredPower);
  const unsigned char  manufacturerData[26] = {0x4c, 0x00, 0x02, 0x15, 0xa1, 0x96, 0xc8, 0x76, 0xde, 0x8c, 0x4c, 0x47, 0xab, 0x5a, 0xd7, 0xaf, 0xd5, 0xae, 0x71, 0x27, 0x00, 0x12, 0x00, 0x25, 0xcb, 0x5c};
  unsigned int lng         = 26;
  blePeriph.setManufacturerData(manufacturerData, lng);
  blePeriph.begin();
  
}

void loop() {
  // put your main code here, to run repeatedly:
 blePeriph.poll();
}

Sunday, July 29, 2018

Changing the Local Name of Sparkfun's nrf52832 IOT Board

I had been playing with Sparkfun's nrf52832 IOT Board(there is no Chinese spoof version yet and I guess there will never be) ever since I found the IB003N-SHT to be defective. My goal is to develop a firmware using Arduino IDE to make the board function as Ibeacon/Eddystone and at the same be able to advertise sensor data in a different frame. I am still familiarizing my self how to make things done and am currently trying make a prototype whether it is possible to change beacon parameters without hard-resetting the device.

I have so far succeeded. My initial test was to change the local name which a very common function and I have not made it to function as a beacon. I am taking it 1 step at a time. I used the sample program provided by Sparkfun on their website which is the Ble Blink Example. I added the following features:

  1. Added a new Service to change the local name
  2. Added a characteristics under the new Service
  3. When the value on the said characteristic change, it will change the local name and reset the BLE.
The logic is very much the same as the original program when turning on/off the LED connected at pin 7. And here is the source code :
// Import libraries (BLEPeripheral depends on SPI)
#include <SPI.h>
#include <BLEPeripheral.h>

//////////////
// Hardware //
//////////////
#define LED_PIN    7 // LED on pin 7
#define LED_ACTIVE LOW // Pin 7 LED is active low
#define LED_DEFAULT LOW

///////////////////////
// BLE Advertisments //
///////////////////////
const char * localName = "LED Off"; //change the local name
BLEPeripheral blePeriph;
BLEService bleServ("1207");
BLEService chgName("1208");//added new service
BLECharCharacteristic ledChar("1207", BLERead | BLEWrite);
BLECharCharacteristic chgChar("1208", BLERead | BLEWrite);//added new characteristics
int vb =0;
void setup() 
{
  Serial.begin(115200); // Set up serial at 115200 baud
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, !LED_ACTIVE);

  setupBLE();
}

void loop() 
{
  blePeriph.poll();
//--
  if (ledChar.written())
  {
    int ledState = ledChar.value();
     if (ledState) {
      digitalWrite(LED_PIN, LED_ACTIVE);
     } else {
      digitalWrite(LED_PIN, !LED_ACTIVE);
    }
}
//--
//--This my added service when change this is triggered
  if (chgChar.written())
  {
    int chgState = chgChar.value();
    
    if (chgState) {
  
       blePeriph.end();
       setupBLE0();
     
    } else {
     
     blePeriph.end();
     setupBLE1();
    }
}
//--
}

void setupBLE()
{
  // Advertise name and service:
  blePeriph.setDeviceName(localName);
  blePeriph.setLocalName(localName);
  blePeriph.setAdvertisedServiceUuid(bleServ.uuid());

  // Add service
  blePeriph.addAttribute(bleServ);
  // Add characteristic
  blePeriph.addAttribute(ledChar);
  //my New Service and characteristic
  blePeriph.addAttribute(chgName);
  blePeriph.addAttribute(chgChar);

// Now that device6, service, characteristic are set up,
// initialize BLE:
  blePeriph.begin();
// Set led characteristic to default value:
  ledChar.setValue(!LED_ACTIVE);  
}
void setupBLE1()
{
 // Advertise name and service:
  blePeriph.setDeviceName("LED Off");
  blePeriph.setLocalName("LED Off");
 // initialize BLE:
  blePeriph.begin();
}
void setupBLE0()
{
  // Advertise name and service:
  blePeriph.setDeviceName(localName);
  blePeriph.setLocalName(localName);
// initialize BLE:
  blePeriph.begin();
}
And here is the video on how it is done(1208 is the new service visible in nRF Connect: