Posts

Showing posts from February, 2019

How it works: The PFC8574T I2C 8 Bit Adapter with the Vishay 20x4 LCD

Image
Using the I2C 4 line LCDhttps://www.rhydolabz.com/wiki/?p=16424
There is a section on the I2C LCD Backpack.
PFD8574  ------------------->    20x4 LCD Header Strip  
(4)  D0                          4  Rs   H/L Register Select
(5)  D1                          5  R/W  H/L Read/write 
(6)  D2                          6  E    H/L Enable     
(7)  D3                                    --NC--       
(9)  D4                          11 DB4  data bus 0x10  
(10) D5                          12 DB5  data bus 0x20  
(11) D6                          13 DB6  data bus 0x40  
(12) D7                          14 DB7  data bus 0x80  
only the upper 4 bits are used to write a character into the LCD, the lower 3 bits are control bits.
PFC8574 DataSheethttps://www.nxp.com/docs/en/data-sheet/PCF8574_PCF8574A.pdf


http://raspberry-at-home.com/lcd-for-raspberry-pi-hd44780-via-pcf8574-i2c-openelec/

pi@raspberrypi:~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- …

Center image in HTML DIV horizontally

Image
First Part is the CSSSomebody once said "I have an img in a div and I want this image to be exactly in the middle of the div but nothing I try works..."
Suppose you want to place 2 images side by side and centered in their div elements. you need to edit your style sheets to have an outer div, and 2 inner divs, and an image element inside the inner divs. You need to set your margin sides to auto, and your width to 50%

div.column-2-block { position:relative; float: left; display:inline-block; border: 0px red solid; margin-top:25px; } div.column-inside { position:relative; float: left; display:inline-block; border: 0px green solid; width:50%; } div.image-holder { position:relative; display:block; }// THIS CSS WILL MAKE IT CENTERED img.centered { margin:0 auto; width:50%; }
Then the HTML code
<div class="column-2-block"> <div class="column-inside"> <img class="centered" src="https://cdn.shopify.com/s/…

Configure Shoretel Voicemail Notifications to your email inbox using a free SMTP relay

Image
Configure Your Shoretel Voicemail Server to Send Voicemails As Wave Files to your inbox How Can SocketLabs Help You Setup a Free SMTP Relay Socketlabs is a free and paid service that can allow you to send 2000 free SMTP message relays every month from your verified domain. But first you need a real domain with it's own email accounts and a professional looking website on top of that, plus you need to look like a legitimate business with contact numbers and email addresses. It is not for spammers, hackers, phreakers, or junk mail junkies. Once you are ready, you create a free account at SocketLabs.com then allow the admins to verify your email and your web presence.  Once that's done, you get your credentials for their free SMTP relay that you can use in your IIS SMTP gateway to send free emails from your voicemail appliances, and your other IOT things that need to send email out, but cannot authenticate.  Many devices cannot authenticate to SMTP servers such as Shoretel voice…

Rasberry Pi i2c as a /dev/ device in ANSI C

I2C Is Just like SMBus
You can always use WiringPI code library from GIT.

git clone https://github.com/WiringPi/WiringPi.git

Which will make the whole thing easier.
#include <fcntl.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <stdint.h> #include <time.h> #include <sys/ioctl.h> #include "linux/i2c-dev.h" int main(int argc, char *argv[]) { int fd; struct timespec _500ms; _500ms.tv_sec = 0; _500ms.tv_nsec = 5000000L; fd = open("/dev/i2c-1", O_RDWR); if(fd < 0) { fprintf(stderr, "Error opening device\n"); exit(EXIT_FAILURE); } if(ioctl(fd, I2C_SLAVE, 0x20) < 0) { fprintf(stderr, "Error setting slave address\n"); close(fd); exit(EXIT_FAILURE); } char buf[10]; buf[0] = 0x07; // IODIR PORT1 buf[1] = 0x00; // all output if(write(fd, buf, 2) != 2) { fprintf(…

Raspberry Pi I2C Connectors and Pinout

Image
I2C - Inter Integrated Circuit I2C pins in BCM mode are: 2, 3 I2C pins in WiringPi are: 8, 9 The UART pins are 14 and 15, TXD, RXD. /dev/serial0 The Raspberry Pi's I2C pins are an extremely useful way to talk to many different types of external peripheral; from the MCP23017 digital IO expander, to a connected ATmega. The I2C pins include a fixed 1.8 kohms pull-up resistor to 3.3v. This means they are not suitable for use as general purpose IO where a pull-up is not required. You can verify the address of connected I2C peripherals with a simple one-liner: sudo apt-get install i2c-toolssudo i2cdetect -y 1 You can then access I2C from Python using the smbus library: import smbusDEVICE_BUS =1DEVICE_ADDR =0x15bus = smbus.SMBus(DEVICE_BUS)bus.write_byte_data(DEVICE_ADDR,0x00,0x01)
Example with a pimoroni scrollphathdpi@raspberrypi:/usr/lib/python3/dist-packages/scrollphathd $ sudo i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- --…