PADI IoT Dongle used for GPIO Expansion
#1
   

This pic above shows the PADI IoT Dongle being used on the ThinkPad T61 for GPIO expansion !  

I have mapped the J4 pin(6) connector  { I2S1_MCK-UART0_OUT } to the PADI GC3  PC_3 :

To turn GC3 ON|OFF:

ATSG=W,PC_3,1,1      { direction OUT  ON  }
ATSG=W,PC_3,0,1      { direction OUT  OFF }

   

Pic above shows the ATSG command , and PADI response for  ON

J4 pin(1)   = 3v3
J4 pin(2)   = GC2  PC_2
J4 pin(3)   = GC0  PC_0
J4 pin(4)   = GC1  PC_1
J4 pin(5)   = Ground
J4 pin(6)   = GC3  PC_3

J2 pin(2)   = GC4  PC_4
Note:  for my purposes, I replaced R11 with a zero ohm shunt   (see schematic  I2C1)

J7 pin(1)     = 3v3
J7 pin(2)   = Ground
J7 pin(5)   = GA5  PA_5

Note:  J5, J10, J12, J13  VDD =5v is on pin(1) !!    { see schematic  A0, A1, A2, A3  on pin(2)  }

This is encouraging because PADI IoT Dongle may also be used to expand the Pinebook for GPIO access , as well wifi, I2C, I2S, & SPI.


Note:   the small purple daughter card mounted on the PADI female header pins in the background is the optional four(4) channel 12bit ADC !

Note:   the PADI IoT Dongle shows up on the ThinkPad ( Mint Linux ) as ttyUSB0

Note:   individual GPIO expansion will require color chart for port mapping

Note:   not all GPIO pins are available out-of-box   with ATSG command

Note:   will wait on tllim for final version before publishing port mapping;


   

The pic above shows pin(4) GC1 active;  PC_1  ON

The small chip in the foreground on the PADI IoT Dongle is a PL2303 usb TTL serial bridge chip;  on-board ttl bridge is handy because no external cable is required. 

In the pic the blue wire is ground, and the orange wire is the signal wire (in this case GC1).
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#2
You might want to explain what the PADI IoT Dongle is first since it isn't available on the pine64 shop yet, so no one even knows it exists or what it does. Wink

Looks nice though.. means no separate UART device needed, and all the I/Os are nicely broken out.
  Reply
#3
(03-27-2017, 07:28 PM)pfeerick Wrote: You might want to explain what the PADI IoT Dongle is first since it isn't available on the pine64 shop yet, so no one even knows it exists or what it does. Wink

Looks nice though.. means no separate UART device needed, and all the I/Os are nicely broken out.

oh,  sorry,  I thought it was obvious;

...  the PADI IoT Dongle is padi stamp breakout with built-in PL2303 usb serial bridge which is designed to provide wifi , i2c, i2S , & SPI  via usb dongle.   The padi IoT Dongle, and the PADuino are padi stamp products in the pipeline ;  coming soon, after the pinebook ships.

The PADuino is an "Uno-like" padi stamp ; not shown.
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#4
   

This pic shows my stepper ( logic load ) attached to the 4bit GCx channel.  Once I get the pattern adjusted ,  I will be able to drive my full | half  step motor directly from the T61;  or via wifi from another system.

   

I this shot I'm driving the PADI IoT Dongle at the same rate ( stepper rate ) from the padi_LED_lab.py python codes;  from this angle both the green and red comm lights are visible, and the green LED appears to be oscillating rapidly back'n forth from left to right.

{will post the codes shortly}
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#5
The following Python codes were written on the Pine board and moved over the ThinkPad T61 (Mint Linux) and ran without modification; with the exception of the device name, and the baud rate.

Click on this link to see a video of the padi_LED_lab in action.

The video is a close-in on the blinker() function found in the codes below.

padi_LED_lab.py

Code:
#
# padi_LED_lab.py  v0.1b
#
# mark h harris
# 11-16-2016
# 03-27-2017
#
# core
#    ser.open()
#    ser.close()
#    ser.isOpen()
#    ser.read(n)
#    ser.write('ATx\r')
#    ser.inWaiting()
#
# extended
#    serfmt(n)        serfmt(ser.inWaiting())
#    serwrt('ATxx')
#    serend()
#
# gpio
#    GC0(isbool)
#    GC1(isbool)
#    GC2(isbool)
#    GC3(isbool)
#    GC_blink(gc, n, n_time)
#    blinker(n_time)
#
#    Change Log:
#
import serial as SER
import time as TM

ser = SER.Serial (
   port='/dev/ttyUSB0',
   baudrate=38400,
   parity=SER.PARITY_NONE,
   stopbits=SER.STOPBITS_ONE,
   bytesize=SER.EIGHTBITS
)

def serfmt(n):
   outp=''
   for i in range(n):
       inp=ser.read(1)
       if inp!='\r' and inp!='\n':
           outp+=inp
       if inp=='\r':
           a=1
       if inp=='\n':
           print(outp)
           outp=''

def serwrt(datastr):
   return ser.write(datastr + '\r')

def GC0(isbool):
   if isbool:
       onoff='1'
   else:
       onoff='0'
   wrtlen = serwrt('ATSG=W,PC_0,'+onoff+',1')

def GC1(isbool):
   if isbool:
       onoff='1'
   else:
       onoff='0'
   wrtlen = serwrt('ATSG=W,PC_1,'+onoff+',1')

def GC2(isbool):
   if isbool:
       onoff='1'
   else:
       onoff='0'
   wrtlen = serwrt('ATSG=W,PC_2,'+onoff+',1')

def GC3(isbool):
   if isbool:
       onoff='1'
   else:
       onoff='0'
   wrtlen = serwrt('ATSG=W,PC_3,'+onoff+',1')

def GC_blink(gc, n, n_time):
   for i in range(n):
       gc(True)
       TM.sleep(n_time)
       outnull = ser.read(ser.inWaiting())
       gc(False)
       TM.sleep(n_time)
       outnull = ser.read(ser.inWaiting())

def blinker(n_time):
   kybInt=False
   cycleCount=0
   startTime=TM.time()
   while not kybInt:
       try:
           GC_blink(GC0, 1, n_time)
           GC_blink(GC1, 1, n_time)
           GC_blink(GC2, 1, n_time)
           GC_blink(GC3, 1, n_time)
           outnull = ser.read(ser.inWaiting())
           GC_blink(GC3, 1, n_time)
           GC_blink(GC2, 1, n_time)
           GC_blink(GC1, 1, n_time)
           GC_blink(GC0, 1, n_time)
           outnull = ser.read(ser.inWaiting())
           cycleCount+=1
       except KeyboardInterrupt:
           TM.sleep(.225)
           outnull = ser.read(ser.inWaiting())
           mins_time=(TM.time()-startTime)/60.0
           cpm_freq=cycleCount/mins_time
           GC3(False)
           TM.sleep(.125)
           GC2(False)
           TM.sleep(.125)
           GC1(False)
           TM.sleep(.125)
           GC0(False)
           TM.sleep(.125)
           outnull = ser.read(ser.inWaiting())
           print('\n\nCycle Count: '+str(cycleCount)+'\n')
           print('\ntime: '+str(mins_time)+' mins.\n')
           print('\ntime: '+str(mins_time/60.0)+' hrs.\n')
           print('\nfreq: '+str(cpm_freq)+' cpm.\n')
           print('\nblinker successfully terminated via interrupt\n')
           TM.sleep(.225)
           ser.close()
           kybInt=True

def serend():
   ser.close()
   quit()

.pdf   PADI_IoT_Dongle_board_161219.pdf (Size: 73.43 KB / Downloads: 133)
(see schematic above)
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#6
(03-28-2017, 05:03 PM)MarkHaysHarris777 Wrote: The following Python codes were written on the Pine board and moved over the ThinkPad T61 (Mint Linux) and ran without modification; with the exception of the device name, and the baud rate.

Click on this link to see a video of the padi_LED_lab in action.

The video is a close-in on the blinker() function found in the codes below.

padi_LED_lab.py

Code:
#
# padi_LED_lab.py  v0.1b
#
# mark h harris
# 11-16-2016
# 03-27-2017
#
# core
#    ser.open()
#    ser.close()
#    ser.isOpen()
#    ser.read(n)
#    ser.write('ATx\r')
#    ser.inWaiting()
#
# extended
#    serfmt(n)        serfmt(ser.inWaiting())
#    serwrt('ATxx')
#    serend()
#
# gpio
#    GC0(isbool)
#    GC1(isbool)
#    GC2(isbool)
#    GC3(isbool)
#    GC_blink(gc, n, n_time)
#    blinker(n_time)
#
#    Change Log:
#
import serial as SER
import time as TM

ser = SER.Serial (
   port='/dev/ttyUSB0',
   baudrate=38400,
   parity=SER.PARITY_NONE,
   stopbits=SER.STOPBITS_ONE,
   bytesize=SER.EIGHTBITS
)

def serfmt(n):
   outp=''
   for i in range(n):
       inp=ser.read(1)
       if inp!='\r' and inp!='\n':
           outp+=inp
       if inp=='\r':
           a=1
       if inp=='\n':
           print(outp)
           outp=''

def serwrt(datastr):
   return ser.write(datastr + '\r')

def GC0(isbool):
   if isbool:
       onoff='1'
   else:
       onoff='0'
   wrtlen = serwrt('ATSG=W,PC_0,'+onoff+',1')

def GC1(isbool):
   if isbool:
       onoff='1'
   else:
       onoff='0'
   wrtlen = serwrt('ATSG=W,PC_1,'+onoff+',1')

def GC2(isbool):
   if isbool:
       onoff='1'
   else:
       onoff='0'
   wrtlen = serwrt('ATSG=W,PC_2,'+onoff+',1')

def GC3(isbool):
   if isbool:
       onoff='1'
   else:
       onoff='0'
   wrtlen = serwrt('ATSG=W,PC_3,'+onoff+',1')

def GC_blink(gc, n, n_time):
   for i in range(n):
       gc(True)
       TM.sleep(n_time)
       outnull = ser.read(ser.inWaiting())
       gc(False)
       TM.sleep(n_time)
       outnull = ser.read(ser.inWaiting())

def blinker(n_time):
   kybInt=False
   cycleCount=0
   startTime=TM.time()
   while not kybInt:
       try:
           GC_blink(GC0, 1, n_time)
           GC_blink(GC1, 1, n_time)
           GC_blink(GC2, 1, n_time)
           GC_blink(GC3, 1, n_time)
           outnull = ser.read(ser.inWaiting())
           GC_blink(GC3, 1, n_time)
           GC_blink(GC2, 1, n_time)
           GC_blink(GC1, 1, n_time)
           GC_blink(GC0, 1, n_time)
           outnull = ser.read(ser.inWaiting())
           cycleCount+=1
       except KeyboardInterrupt:
           TM.sleep(.225)
           outnull = ser.read(ser.inWaiting())
           mins_time=(TM.time()-startTime)/60.0
           cpm_freq=cycleCount/mins_time
           GC3(False)
           TM.sleep(.125)
           GC2(False)
           TM.sleep(.125)
           GC1(False)
           TM.sleep(.125)
           GC0(False)
           TM.sleep(.125)
           outnull = ser.read(ser.inWaiting())
           print('\n\nCycle Count: '+str(cycleCount)+'\n')
           print('\ntime: '+str(mins_time)+' mins.\n')
           print('\ntime: '+str(mins_time/60.0)+' hrs.\n')
           print('\nfreq: '+str(cpm_freq)+' cpm.\n')
           print('\nblinker successfully terminated via interrupt\n')
           TM.sleep(.225)
           ser.close()
           kybInt=True

def serend():
   ser.close()
   quit()
Thanks.
  Reply
#7
Note:   modified post #1 with some additional details, including R11 mod.
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#8
You say that Pine is releasing these two new things, but is the current PADI Stamp suitable for new designs? I am evaluating it, but am concerned about committing to it because I noticed on the realtek website, the 8710AF is no longer listed as a product, but seems to have been replaced with the RTL8710BN that is significantly different (Cortex M4, less RAM, seems to run code in place off an external SPI flash).
  Reply
#9
(03-30-2017, 02:43 PM)bluedevil97 Wrote: You say that Pine is releasing these two new things, but is the current PADI Stamp suitable for new designs? I am evaluating it, but am concerned about committing to it because I noticed on the realtek website, the 8710AF is no longer listed as a product, but seems to have been replaced with the RTL8710BN that is significantly different (Cortex M4, less RAM, seems to run code in place off an external SPI flash).

Did you find an official press release stating that the 8710AF is not supported , nor being released ?

... tllim says that the padi stamp will be available in the near future as three offerings ( once pinebook distribution is underway ) paduino, padi IoT dongle, and the current padi & breakout

My role here is to evaluate these devices,  help people understand what they are and how they work, and maybe provide some samples;   my role is not RealTek marketing, nor press accounting.



These devices use SPI flash (internal or external).  The software | firmware of the padi may be replaced with the SW debugging tool (Pine Store) and by using the SDK ( a new version is available shortly ). whether the new padi(s)  will use a newer RealTek processor I have no idea.

The PADI IoT Dongle was not designed (initially) to provide GPIO(s) for the pinebook offering;  but it does look like it can be used for precisely that.  The PADI breakout (with padi) can be used the same way; however, that does require a serial ttl usb bridge cable. Keep watching here;  I will be adding a GPIO SPI expansion to the PADI IoT Dongle that will be a simplified serial to parallel converter !   (rather than serial peripheral interface);   for 8, 16, or 24 +   GPIO lines output.

As it is, the PADI IoT Dongle provides six(6) individual GPIO outputs,  as well as the designed SPI, I2S and I2C ports;  and ADC analogue inputs ( four channel 12bit optional board ).
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#10
for what it is worth i read a report awhile back that the 8710 was also made by a company known as b&t and that the 8710 they made was pin compatible with the 8266 module. i have not looked into it but i can't see any reason that the padi would be different than the b&t thus making it possible to use the padi on 8266 boards if you can find any of those as kits it would make an interesting alternative way to breakout the padi.
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Basic question ti use padi ad i/o remote module [email protected] 2 1,201 11-02-2018, 02:20 PM
Last Post: [email protected]
  some questions regarding the PADI schepers_cp 10 1,392 08-20-2018, 09:49 AM
Last Post: dkryder
Information Padi IRC Channel pfeerick 1 1,378 07-17-2017, 02:47 PM
Last Post: tllim
  Padi Stamp LED pcb symbol is incorrect dkryder 4 1,640 03-11-2017, 11:02 PM
Last Post: pfeerick
  Padi Stamp v2.2.1, v3.5 (2016/10/08-16:57:18) MarkHaysHarris777 62 15,480 03-11-2017, 01:09 AM
Last Post: MarkHaysHarris777
  Several PADI connected to Pine via Wifi Traveler 3 1,083 02-07-2017, 07:10 AM
Last Post: MarkHaysHarris777
  broadcasting with padi stamp ? Grag38 2 653 01-31-2017, 08:23 AM
Last Post: Grag38
  PADI IoT Stamp is starting to get noticed... pfeerick 12 2,548 12-15-2016, 10:42 AM
Last Post: tllim

Forum Jump:


Users browsing this thread: 1 Guest(s)