Sunday, February 24, 2019

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

Using the I2C 4 line LCD

https://www.rhydolabz.com/wiki/?p=16424
There is a section on the I2C LCD Backpack.
The PFC8574T I2C to 8 bit IO adapter backpack onto Vishay LCD-020N004L
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 DataSheet

https://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:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@raspberrypi:~ $

20x4 LCD Commands
https://mil.ufl.edu/3744/docs/lcdmanual/commands.html

Buy One
https://www.aliexpress.com/item/Character-LCD-Display-Module-20x4-LCD2004-IIC-I2C-TWI-2004-Display-PCF8574-for-Arduino-Uno-r3/32961369887.html?spm=a2g0s.9042311.0.0.52774c4dWuk3kg

Coming Soon - Our Own LCD Application written in Ansi C

https://github.com/biffmartin/lcd-i2c-pfc8574

Brought to You By

This Tech Tidbit was brought to you by your IoT Experts at Eleven Dimensions Computer Technologies. See the new 11D website at:

See Our Partner Websites:

Bare Wire Networks:     http://www.barewirenetworks.com
CTI Solutions:   http://www.cti-solutions.com

Many Thanks to Our Partner companies



Tuesday, February 19, 2019

Center image in HTML DIV horizontally

First Part is the CSS

Somebody 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%

  1. 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; }
  2. // THIS CSS WILL MAKE IT CENTERED img.centered { margin:0 auto; width:50%; }

Then the HTML code
  1. <div class="column-2-block"> <div class="column-inside"> <img class="centered" src="https://cdn.shopify.com/s/files/SOS.png" width="320"> </div> <div class="column-inside"> <img class="centered" src="https://cdn.shopify.com/s/files/watch.jpg" width="400"> </div> </div>


The Result


Sunday, February 10, 2019

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

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 10000 free SMTP 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 voicemail servers, all in one printers, fax machines. They only know how to send simple SMTP to port 25.  SocketLabs and your own IIS server can be the intermediate gateway for these devices.  Fore more information, you may contact Eleven Dimension Technologies or see our website at:  https://www.elevendimensions.com On this blog entry, we will show you how to setup an intermediate SMTP gateway that can work as an open relay, that will then forward the email messages to another SMTP gateway that can then forward your mail out to the real world into people's inboxes.

About Eleven Dimensions Technologies

Eleven Dimensions Technologies is a Shoretel dealer, installer and servicer in Southern California.  We sell pre-owned/grey-market parts and software from systems that have been pulled out of service, we also sell pre-owned licences at a discount, we can sell system licences with a matching ethernet card as well as component licenses such as softphone and workgroup supervisor or any other kind of license.  We have retired and obsoleted many systems over the years and replaced with them with cloud hosted voip systems or have bought out shoretel systems from closed out businesses.  We will also help you with system tuning such as voicemail to email, or you can read the instructions below.  Furthermore, we have developed a custom reporting application that will blow the socks off anything that Shoretel or its partners have built.  Don't waste your money on new equipment, when you can get perfectly good refurbished equipment, software and licences at a fraction of the price. See our great story on shoretel history.

Shoretel Director

The Shoretel phone system, all verisons and the new Mitel versions include functionality to send voicemails as .WAV files to your email inbox to any email domain. To do this you need to configure your shoretel server and your IIS6.0 SMTP server.  This is the most basic of CTI tasks that you can do.   My example was done on Windows Server 2008 R2, I have also tried this on Windows Server 2012 R2. It works the same.

Here are a few steps to take to make it happen.

Install IIS6 and the TELNET client on your shoretel director server.
Logon to Shoretel Director and Click on "Voice Mail" in the left column menu, enter a From Address for Email Notifications.
Enter the email address associated with your socketlabs account

Now Visit the Sites menu, and set the SMTP Relay Address, It should be the IP Address of your Shoretel Director server with the IIS6 server.


Finally, for each mailbox, be sure to visit the "Escalation Profiles and Other Mailbox Options" menu in each profile at the bottom of the page,

IIS Configuration

Finally, you need to configure your IIS6 server to send email. You will need to register for a SocketLabs email sender account at https://www.socketlabs.com/ You can get a free account for 2000 SMTP relays. First you'd better have a working domain with an email account to recieve verification emails and a working website, not just some placeholder. You need a working website that make you look legitimate. Once you register, visit the SMTP credentials and set them up. Get them and save them. You can only send emails from your own domain name.
Configure as follows:
Click on "SMTP Virtual Server #1" and bring up the properties page
Domains only include SHORETEL (your computer name)
Properties Page
In each tab, configure as follows: Access Tab: Relay Button, grant the entire subnet permssion.Authentification: "Anonymous Access" only checked. Messages Tab: No Change, Delivery Tab: Configure Outbound Security: Basic Authentifiction, and TLS Encryption. drop in your username and password from the SMTP page of socketlabs, Outbound Connections: set the TCP Port to 25. Advanced Delivery page,
The Advanced Button

Outbound Security
Security Tab


Finally restart the IIS SMTP service. Then test it out by using the Windows Telnet Client on the MSDOS command line. Use this command: telnet IPAddress 25, then paste in this test script: (if your domain on socketlabs was yadayada.com

ehlo yadayada.com
mail from: JoJo@yadayada.com
rcpt to: SamSmith@theirdomain.com
rcpt to: JoeBlow@yahoo.com
data
subject: Hello This is a Test, thanks! 
to: SamSmith@theirdomain.com
hey ya did you get it?

.

quit

This script will trigger an email to be sent out thru your IIS6 SMTP virtual server via socket labs. You must have registered yadayada.com as your domain on socketlabs.

You should check these directories on your server:
C:\inetpub\mailroot\Queue
C:\inetpub\mailroot\Badmail

If you see anything there, then you have done it wrong.

Your SMTP log files are in this directory:
C:\Windows\System32\LogFiles\SMTPSVC1

A normal transaction with socketlabs looks like this:

There are Other Free SMTP Services Out There

Here's list of more.

Many Thanks To

This Tech Tidbit was brought to you by your friends at Eleven Dimensions Computer Technologies.
Eleven Dimensions is a Shoretel dealer and installer in Southern California, we can help you reduce the maintenance cost of your shoretel system with our low break/fix contract rates or our low contract MSP rates. Call us anytime.:

Our Partner Websites:

Bare Wire Networks:     http://www.barewirenetworks.com
CTI Solutions:   http://www.cti-solutions.com

Saturday, February 9, 2019

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.
  1. #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(stderr, "Error writing (1)\n"); close(fd); exit(EXIT_FAILURE); } printf("Write success!\n"); nanosleep(&_500ms, NULL); buf[0] = 0x01; // PORT1 buf[1] = 0xff; // output high if(write(fd, buf, 2) != 2) { fprintf(stderr, "Error writing (2)\n"); close(fd); exit(EXIT_FAILURE); } close(fd); printf("Done.\n"); exit(EXIT_SUCCESS); }

Raspberry Pi I2C Connectors and Pinout

I2C - Inter Integrated Circuit


I2C pins in BCM mode are: 2, 3

I2C pins in WiringPi are: 8, 9


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:
  1. sudo apt-get install i2c-tools
  2. sudo i2cdetect -y 1
You can then access I2C from Python using the smbus library:
  1. import smbus
  2. DEVICE_BUS = 1
  3. DEVICE_ADDR = 0x15
  4. bus = smbus.SMBus(DEVICE_BUS)
  5. bus.write_byte_data(DEVICE_ADDR, 0x00, 0x01)

  1. Example with a pimoroni scrollphathd
pi@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: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- 74 -- -- --
Thanks to our friends at: https://pinout.xyz/pinout/i2c