Atmega 8 pin mapping

Atmega8 to Arduino pin mapping

Here is an easy to refer mapping of Atmega 8 pins to Arduino.  Credit of this image goes to user called “System” on Arduino forum https://forum.arduino.cc/u/system/summary

The image has been taken from the post https://forum.arduino.cc/t/pwm-didnt-work-on-atmega8/248564

A neat and to the point image like this is rare on the internet. I have just put the image here as a mirror of the original to ensure availability.

Continue reading Atmega8 to Arduino pin mapping

Places Search API Call

Here is summary of how to call Places search API of Bing, Google and Here Map.

Here is little known among most developers, specially developers of India, but it is a good API and there map is also very good. Their map have internal maps (floor layout) of many buildings.

Here Maps API Call

Below is the latest v7 API, all other APIs are obsolete
Continue reading Places Search API Call

Firebase Web Push Browser Issue

As of today, 2nd of July 2021. FCM libraries have some bugs due to which it fails to get tokens sometimes in Chrome browsers current version.

Errors that occurs :

  1. Uncaught (in promise) FirebaseError: Messaging: A problem occured while subscribing the user to FCM: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project. (messaging/token-subscribe-failed)
  2. “Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

How to integrate Firebase Push Notifications for Websites: https://www.kolkataonweb.com/code-bank/miscellaneous/website-push-notification-with-google-firebase/

 

Free Online Tools or Software for Electronic Circuit Simulation

https://www.circuitlab.com/
Though free but only a few tries for each session. Not much useful.

https://www.multisim.com/
This is good. So  far I have used for simulating small sections like filters, transistor amplifiers etc. The free version served the purpose.

https://www.falstad.com/mathphysics.html
Various Simulation tools are there. Yet to explore much.

Please note – The information provided here is on as is basis. I don’t guarantee their accuracy and proper functioning.

JSON for Creating Paypal Subscription Plan

Hope this save some time for someone.

The concept is for each products there will be one or more subscription plan. End users will be presented with the Subscription plans. And they will buy the subscription.

The subscription plans can be created from both Paypal Dashboard and using REST API. Here is the REST API method.

Request URL
https://api-m.paypal.com/v1/billing/plans/

Method
Post

Header
Authorization:  Bearer A3xxxxxxxxxxr-LXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXcOFiuF7__PXXXXXXXXXXXXX_YuJNIHYHGTJG
PayPal-Request-Id: TEST-REQ-ID-12345       —-  This is optional. Passing this will make consequent requests work on same initial Request. Better to omit it.

BODY

{
  "product_id": "PRODCUCT ID OF CORRESPONDING PRODUCT",
  "name": "THE NAME of Subscription Plan GOES HERE",
  "description": "THE DESCRIPTION Subscription Plan GOES HERE",
  "billing_cycles": [
    {
      "frequency": {
        "interval_unit": "MONTH",
        "interval_count": 1
      },
      "tenure_type": "REGULAR",
      "sequence": 1,    //sequence is important when there are trials. Trials will be 1 and regular packages can be 2 onwards.
      "total_cycles": 0,  // 0 means unlimited
      "pricing_scheme": {
        "fixed_price": {
          "value": "1.99",
          "currency_code": "USD"
        }
      }
    }
  ],
  "payment_preferences": {
    "auto_bill_outstanding": true,
    "setup_fee": {
      "value": "0",
      "currency_code": "USD"
    },
    "setup_fee_failure_action": "CONTINUE",
    "payment_failure_threshold": 1
  },
  "taxes": {
    "percentage": "0",
    "inclusive": false
  }
}

Return

This will return the auto-generated Plan-ID. The plan id will be needed for integration in frontend.
The Plan-ID can also be found from the Paypal Dashboard's subscription section.

 

How to get Token with Paypal Rest API

How to create products with Paypal Rest API

Paypal REST API create products

Request URL
https://api-m.paypal.com/v1/catalogs/products

Method: Post

Header
Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  // xxxxxxxxxxxxxxxx  is base64 encoded Client ID:Secret  // base64_encode(client_id_string:client_secret_string) – note the colon in between
PayPal-Request-Id:TEST-REQ-ID-12345       —-  This is optional. Passing this will make consequent requests work on same initial Request. Better to omit it.

Body

{
  "id": "YOUR OWN PRODUCT ID",
  "name": "NAME",
  "status": "ACTIVE",
  "description": "DESCRIPTION GOES HERE",
  "type":"DIGITAL", //SUITABLE TYPE
  "category":"SOFTWARE",  //SUITABLE CATEGORY
  "home_url":"YOUR WEBSITE PAGE - WHERE DETAILS OF PRODUCT IS THERE"
}

Return
The call will return the same details on success

Paypal REST API get token

Request URL
https://api-m.paypal.com/v1/oauth2/token

Method
Post

Headers
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  // xxxxxxxxxxxxxxxx  is base64 encoded Client ID:Secret  // base64_encode(client_id_string:client_secret_string) – note the colon in between

Body
grant_type:client_credentials

Return

{

"scope": "https://uri.paypal.com/services/invoicing https://uri.paypal.com/services/disputes/read-buyer https://uri.paypal.com/services/payments/realtimepayment https://uri.paypal.com/services/disputes/update-seller https://uri.paypal.com/services/payments/payment/authcapture openid https://uri.paypal.com/services/disputes/read-seller https://uri.paypal.com/services/payments/refund https://api.paypal.com/v1/vault/credit-card https://api.paypal.com/v1/payments/.* https://uri.paypal.com/payments/payouts https://api.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions https://uri.paypal.com/services/applications/webhooks",
"access_token": "AYYYYYYYYYYWmTopNAjV__Yuk_6AP9RZWQpzxxxxxxxxxxxxxx1ifvHLHrE6RW_Zqjbieo3jcZr9999999999999999lyDA",
"token_type": "Bearer",
"app_id": "APP-XYXYXYXYXYXYCCCC",
"expires_in": 32400,
"nonce": "2021-06-18T16:42:YUKJUKJHTGTYJKHGRRFHFHFGFGBFBG-spy-N9iguUHTJbTgVjht"

}
esp8266-esp-01-wifi-module-for-iot

ESP-01 Flashing Errors

After a few years I started working with an ESP-01 again. But after so many years I forgot the exact parameters of module I have and was using default settings. For hours I couldn’t flash anything to it. Everytime flashing failed with one error or other. The most occurring errors are :

  1. Invalid (unsupported) command 0x8 
  2. Invalid head of packet (0x00)
  3. Invalid head of packet (0x0f)

The above problems can be due to two reasons mainly

  1. Wrong settings
  2. The module needs to be RESET to get the flashing started. The timing of pressing reset and time of holding it down is important. The RESET needs to be done after the Arduino IDE starts the flashing (…. progress bar). And the RESET will have to be hold low for  1 – 2 seconds.
  3. Inadequate power supply

Though many suggested that these errors are due to incompatible signal levels between Arduino and ESP but in my case it was not. Previously also I had successfully flashed without logic level converters.

Proper parameters for ESP-01. Please note Flash mode will need to be set as per the chip. Newer ones need DOUT specifically. Whereas the old ones work with both QIO and DOUT. Burning with wrong mode will result in a successful upload but the code will not work.