What information can i get from OBD II? - obd-ii

I can get the below information from OBD II through ELM 327 adapter.
RPM
Vehicle speed
Engine Load
Coolent Temperature
I would like to know what else i could get from OBD II.

It all depends on the vehicle and what it provides, you can view a list of many possible so called PID:s here on wikipedia
The PID is the id of the property you request from the bus

Related

Fuel Consumtion data via OBD2 is wrong - can you help me out?

So I am trying to get real time fuel consumtions data from my Car (2021 Kia Sorento PHEV) via OBD2. I've read up on the topic and it seems to be simple enough.
Fuel Consumtion in Liters per Hour (PID 5E(hex)/94(dec) "Engine fuel rate") divided by Speed in Km/h == Liters/100km.
The problem is: The results are... absurd. When i coast around town #50km/h and the gauge cluster reads an instant fuel consumtion ~3-4 Liters/100km the OBD2 Data suggest an usage of ~17-21 Liters/100km.
I've started to calculate the fuel rate in l/h manually using MAP AFR etc. Data from the OBDII Port and arrive at the same value for Liters/Hour and therefor for the same absurd instant fuel consumtion values.
OBD2 Bluetooth Dongles and popuplar Apps like "Car Scanner" or Torque also report this insanely high instant fuel consumtion.
So I am asking you guys: Is there some alternate formula for fuel consumtion I (And the developers of all those android apps) am not aware of?
Thanks :)
Instantaneous consumption can show some "wild" results.
Top Gear's Richard Hammond made reference to this in one series when he pointed out he was getting 99mpg going downhill.
If you want an accurate check of fuel consumption then the most accurate that I know of is to "brim" the tank, drive then "brim" the tank again. You then have distance and fuel consumption.

Flatten JSON like data in Postgres 11 Database

I have the following data in a Postgres table that I need to flatten out:
data
===============================================================================================
{"Exterior Lights" :["Headlights - Forward Adaptive","Headlights - Laser","Headlights - LED"]}
{"Generic" : ["Launch Control"]}
{"Mirror" :["Blind Spot Assistant","Door Mirrors - Integrated LED"]}
{"Safety" :["Tyre Pressure Monitoring", "ABS"]}
Ideally the above data it would look like this afterwards:
System Type
======= ====
Exterior Lights Headlights - Forward Adaptive
Exterior Lights Headlights - Laser
Exterior Lights headlights - LED
Generic Launch Control
Mirror Blind Spot Assistant
Mirror Door Mirror - Integrated LED
Safety Tyre Pressure Monitor
Safety ABS
I've tried various combinations of JSON operators but to no avail. Can anyone help?
You need to first extract the key/value pairs as rows which can be done using jsonb_each(). Then you can use jsonb_array_elements_text() to create a row for each array element:
select x.system, u.type
from the_table t
cross join jsonb_each(t.data) as x(system, value)
cross join jsonb_array_elements_text(x.value) as u(type);
Online example

weak instruments stata results

I'm using the command ivregress 2sls, with clusters (each cluster is a school) and with pweights.
I have one endogenous variables x1, and 4 instruments. I'm trying to test my model and check if my instruments are not weak.
I used the estat firstatage command and I'm not sure how to interpret the result.
picture:
results
You might want to try the user-written weakivtest which is available from the SSC (ssc install weakivtest) and an improvement to estat firststage. If your F-test stat rejects the Null at the common significance levels (or the critical values when using weakivtest), your instruments are strong.

Determine Issuer of EMV card

What would be the best way to determine the issuer of a contactless EMV card. I am trying to determine if a card was issued by Amex, Visa or Mastercard. Is that information available via a USB EMV reader? I don't need to pull any other information from the card..
I'm assuming that it could be done by some python, or C++ code interacting with the card. I'm looking for a good jumping off point.
You should be able to get this info from the successful response of SELECT. Store the list of RIDs ( AID = RID + PIX ), and do SELECT one by one. On success, it will return status bytes 90 00, otherwise 6A 82( file not found ).
The easiest option would be through SELECT command as mentioned
before. The list of AID:
https://www.eftlab.com/knowledge-base/211-emv-aid-rid-pix/
The other option would be getting it from the PAN. You can define issuer
based on first 6 digits or 8 digits of the PAN, which represents Issuer
Identification Number (IIN)/Bank Identification Number(BIN).
34, 37 - American Express
4 - Visa
51-55, 2221-2720 - MasterCard
https://en.wikipedia.org/wiki/Payment_card_number#Issuer_identification_number_(IIN)
You would have to send commands:
SELECT
GET PROCESSING OPTIONS
READ RECORD
You would look for 5A - PAN and extract first digits.
Good tool that you can just use to read data from contactless EMV card is:
https://www.javacardos.com/tools/pyresman
You can create your own scripts or just proceed with some basic commands like a SELECT command.

Defining trips and stop sequences for bidirectional route in GTFS

I'm trying to define a GTFS feed for a ferry crossing between 2 ports (A <-> B). There may be 2 ferries running between these ports.
routes.txt
route_id,route_short_name,route_long_name,route_desc,route_type
AB,A-B,A << >> B,Ferry travelling between A and B,4
calender.txt
service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
FULLWEEK,1,1,1,1,1,1,1,20180103,20180430
trips.txt
route_id,service_id,trip_id,trip_headsign,direction_id,shape_id,wheelchair_accessible,bikes_allowed
AB,FULLWEEK,a_b,B Dest,0,ab_shape,1,1
AB,FULLWEEK,b_a,B Dest,1,ab_shape,1,1
stops.txt
stop_id,stop_name,stop_desc,stop_lat,stop_lon,location_type
A,B-A,Travelling from B to A,xxxx,xxxx,1
B,A-B,Travelling from A to B,xxxx,xxxx,1
stop_times.txt
trip_id,arrival_time,departure_time,stop_id,stop_sequence
a_b,02:45:00,03:00:00,A,1
a_b,04:45:00,05:00:00,A,1
b_a,00:45:00,01:00:00,B,2
b_a,03:45:00,04:00:00,B,2
^^ this is where the errors appear in the feed validator
Duplicate stop_sequence in trip_id a_b
I can't work if I should be using 2 routes instead of 1 (and stop using the direction_id value in trips.txt) and what the sequence of the timetables are, since the timetables at both ports may not match up as a sequence as there may be multiple ferries running between the 2 ports.
Thank you.
Figured it out, basically trips.txt must contain an entry for every scheduled departure. I was treating trips like routes, when in fact every departure is it's own "trip".