Wednesday, June 19, 2019

SIM7000E Raspberry Pi HAT Sydney, Australia - Telstra testing

I bought a SIM7000E Raspberry Pi HAT and wanted to test with a Telstra regular mobile phone SIM card. This is how I tested it.

***  Seems to only work with Telstra (PLMN 505-01) 

Bought directly from www.waveshare.com , sent by DHL and arrived in 4 days in Sydney.
 

1) Plug the unit directly in to Raspberry Pi GPIO





2) Connect using UART and Picocom 

raspberry pi 3 model b+  - use port  /dev/ttyAMA0  - read this page on how to change the UART port in raspberry pi --> https://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/

pi@raspberrypi:~ $ picocom --baud 115200 /dev/ttyAMA0
picocom v1.7

port is        : /dev/ttyS0
flowcontrol    : none
baudrate is    : 115200
parity is      : none
databits are   : 8
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv
imap is        :
omap is        :
emap is        : crcrlf,delbs,

Terminal ready
at
OK

3) Check SIM status

at+cpin?
+CPIN: READY

OK

4) Scan for networks. Retry the same command if you get an error.

at+cops=?
+COPS: (1,"505 01","505 01","50501",7),,(0,1,2,3,4),(0,1,2)

OK

PLMN 505-01 is Telstra
PLMN 505-02 is Optus
PLMN 505-03 is Vodafone

It seems like the module only can see Telstra

5) Manually connect to Telstra

at+cops=1,2,"50501"
OK

6) Check signal strength and attached status 

at+csq
+CSQ: 23,99

OK
at+creg?
+CREG: 0,1

OK
 at+cgatt?
+CGATT: 1

OK

 7) Test sending SMS 

at+cmgf=1
OK


at+cmgs="+6148XXXXXXX"
> hi hi hi hi hi
> .
>
+CMGS: 46

OK

8) Test receiving SMS

When you send an SMS to the number of the SIM in the module, these messages will appear on the console

+CMTI: "SM",1

+CMTI: "SM",2

To read individual SMS

OK
at+cmgr=1
+CMGR: "REC UNREAD","+61XXXXXXX",,"19/06/19,14:33:36+40"
Help

OK
at+cmgr=2
+CMGR: "REC UNREAD","+614XXXXXXX",,"19/06/19,14:33:52+40"
How are things

OK


9) Read all SMS

AT+CMGL="ALL"

10) Show massage storage status 

AT+CPMS?

11) Delete all messages 

at+cmgd=0,4

12) Reset

AT+CFUN=1,1 

13) Get band info

AT +CPSI? 

+CPSI: LTE CAT-M1,Online,505-01,0x2029,134409228,328,EUTRAN-BAND28,9410,5,5,-13,-96,-66,14

 

Saturday, May 11, 2019

Get the third highest salary in the employee table - SQL

This is my Table, and I want to get the 3rd highest salary




First lets sort the table by salary in descending order 


Then to get the 3rd highest. Set offset to 2 and get only one line by setting limit to 1.





Traceroute Mac vs Windows

1) Tracert in Windows use ICMP

Packet Capture Link






2 Traceroute in Mac use UDP

 



















Wednesday, April 24, 2019

MCP42100 - 100K with Raspberry Pi 3 model B+ - using spi

MCP42100 is a 100K variable resister controlled using spi interface. The only issue with this one is that it has a very high variation in resistance (high tolerance ) can vary from 70K to 130K

Data sheet - http://ww1.microchip.com/downloads/en/devicedoc/11195c.pdf




Python code for controlling this with SPI


import time
import spidev
import RPi.GPIO as gpio

gpio.setmode(gpio.BCM)
gpio.setup(4,gpio.OUT)

#if you need to open circuit 
#gpio.output(4, gpio.LOW) # Open circuit
#gpio.output(4, gpio.HIGH) # Closed circuit, resistor working


bus = 0 
device = 0

spi = spidev.SpiDev()
spi.open(bus, device)

spi.max_speed_hz = 500000
spi.mode = 0

# try 0 that will set resistance to the min value
res = input("value?")

x = spi.xfer2([19,res])

print(x)


AD5272 - 100K with Raspberry Pi 3 model B+ - using i2c

I am testing this AD5272 digital variable resistor and was really not easy to find any info on how to write to the registers in the ic to change resistance.

Data sheet - https://www.analog.com/media/en/technical-documentation/data-sheets/AD5272_5274.pdf

Useful link - https://stackoverflow.com/questions/46230777/operating-the-ad5272-with-python-3-and-smbus2-on-raspberry-pi-3-b


This is how it work in python,


bus.write_i2c_block_data(Address,First byte,[2nd byte up to 32])

------
import smbus

bus = smbus.SMBus(1)

# This write 0x1c and 0x03 to device with address 0x2c. This unlocks the register
bus.write_i2c_block_data(0x2c,0x1c,[0x03])

# This set the wiper to 0 - get around 30Ohms 
bus.write_i2c_block_data(0x2c,0x04,[0x00])

# This set the wiper to 1023 - get 100K 
bus.write_i2c_block_data(0x2c,0x07,[0xff])

------



I bought this model from DigiKey - AD5272BRMZ-100-RL7CT-ND 

TO solder this I bought a 10MOSP breakout board - LCQT-MSOP10 



Also bought low temperature soldering paste - Chip Quik Inc. / TS391LT 


Used the oven at home to bake it following the graph below.


Used 2.0mm GOOT Desolder Braid to remove soldering bridges