Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Efried
    3. Posts
    E
    • Continue chat with Efried
    • Start new chat with Efried
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by Efried

    • RE: M5 stick C wont turn on am i missing something?

      @zontex After a longer charging my M5stick works, but it is not possible to switch it into USB or WLAN mode, so I may upload code.

      posted in General
      E
      Efried
    • RE: 1-wire and SD-Card

      @zontex Haha you say UIFlow, there is no 1-wire support!
      To my knowledge the "stack" is not really stackable because of a design flaw, using pins for addressing modules, and not a bus!

      posted in M5stack Grey
      E
      Efried
    • RE: Unable to install Windows ATOM (CP210x) drivers

      For the Stick C (orange) the docs say it needs no driver, still the port does not show up. It would be great having more guidance on that for all the M5 products.

      posted in Atom
      E
      Efried
    • Brocken Stick

      The M5Stack is recognized by UIFlow or Thonny, but the M5Stick not, so it is defective?

      posted in M5 Stick/StickC
      E
      Efried
    • RE: UIFlow 1.7.0

      Is there one-wire support for reading DS18B20?
      thanks

      posted in Official Updates
      E
      Efried
    • RE: How to connect DS18B20 - Which pins are available?

      After years it still birps, but does not work.
      Any new hints?

      posted in FAQS
      E
      Efried
    • New but unusable

      Got a fresh Stick but no link to a manual to show how to switch into USB mode.
      Only test mode and scrolling through installed apps is possible.
      thanks

      posted in M5 Stick/StickC
      E
      Efried
    • RE: M5 How-to (general tips and guide)

      @ajb2k3 unfortunately the stick ahs no possibility to be switched into USB mode

      posted in General
      E
      Efried
    • RE: Avoid M5Stack - it is a waste of time

      @thrasher I tried to delete the PM class before creating the GPS class but did nor help- still no gps values - is it feasible to have a software solution, may be not using high leven UIflow mycropython function.

      posted in Bug Report
      E
      Efried
    • Guidance on operatinal mode

      Please add Guidance about the modes in v6 of uiflow on the device:

      • usb mode does not have automatic start of uploaded .py
      • app mode allows start of a preloaded file
      • internet mode may be outphased given the server problems

      Even if the uploaded file does not start, it is correctliy uploaded?

      posted in UIFlow
      E
      Efried
    • RE: How to save data to SD-card

      Would you mind adding some indication about control characters there, like "\r\n"
      Please recognize that you promised fast prototyping using the M5Stack but now it is clear that:

      • it is cumbersome, because the high level uiflow functions are not documented, and no working examples in micropython given to validate the high level functions
      • the combination of modules was not testet (ok a lot of variants)
      • the physical design has some flaws - the screen may brake when assembling, disassembling needs force - may be you may invent a receptacle with unlocking lever

      Do you have a standard before selling modules for quality control, and a test plan?

      posted in Bug Report
      E
      Efried
    • How to save data to SD-card

      The UI flow is nice but you end nothing written to the file, it is only created - please provide an example. may be it needs some control characters
      thanks

      posted in Bug Report
      E
      Efried
    • RE: Avoid M5Stack - it is a waste of time

      @ajb2k3 I'm to beginner in GPS
      No the GPS module does not return a single value, when the PM module is present! May be they share pins.

      posted in Bug Report
      E
      Efried
    • RE: Avoid M5Stack - it is a waste of time

      as expected GPS and PM module do not work together!
      GPS does only work without PM.
      since months the wait() function is not repaired
      Still no running GSM module.
      This is a serious lack of quality!

      posted in Bug Report
      E
      Efried
    • RE: Avoid M5Stack - it is a waste of time

      Thanks for the anwers. Frustration is high now after using the M5Stack for more than a year employing micropython. It seems that this is a good concept but very limited support and small sample code base for micropython compared to other languages. You have to guess the right usage of functions, some are changing underway (urequest). Fortunately the browser based upload had to be abandonned because of a the complex and unreliable system architecture. But it is not acceptable that new firmware versions are published where code upload is broken. Just hold that back.
      And please publish examples using high level commands for every module:
      I mastered now the PM module and the GPS module by trial and error , next I will try them together.
      but the cellular module is either garbage or was not tested to be used with GPRS data transfer. Using all three modules together is another challenge, may be this will not work.
      Since the broken screen and the bricked M5stack are differente devices I could exchange, given some support.
      thanks

      posted in Bug Report
      E
      Efried
    • Avoid M5Stack - it is a waste of time

      You get absolutely no documentation with the modules.
      The firmware updates are erroneous and you may brick the M5stack when returning to a previous version, The IDE dows not know the latest version
      The file upload does not work most of the time , only RUN works, but this is lost after disconnecting
      when asembling the LCD cracks easily

      posted in Bug Report
      E
      Efried
    • Snap in fixture?

      I can't find such in the webshop.
      https://www.thingiverse.com/thing:3133893
      thanks

      posted in Cores
      E
      Efried
    • GPRS on SIM800L

      Do you have an example for me sporting the SIM800L GRPS module to be able to use urequest via WAN?
      many thanks in advance

      posted in Micropython
      E
      Efried
    • RE: PYP SIM800L

      Nothing spectacular

      either trials via module or the example do not work

      what is the order to initiate GPRS transmition - upload to a server?

      This second attempt throws name 'pyb' isn't defined

      from m5stack import *
      from m5ui import *
      from uiflow import *
      import module

      setScreenColor(0x222222)

      Driver for SIM800L module (using AT commands)

      MIT License; Copyright (c) 2017 Jeffrey N. Magee

      https://github.com/jeffmer/micropython-upyphone

      import math

      kludge required because "ignore" parameter to decode not implemented

      def convert_to_string(buf):
      try:
      tt = buf.decode('utf-8').strip()
      return tt
      except UnicodeError:
      tmp = bytearray(buf)
      for i in range(len(tmp)):
      if tmp[i]>127:
      tmp[i] = ord('#')
      return bytes(tmp).decode('utf-8').strip()

      class SIM800LError(Exception):
      pass

      def check_result(errmsg,expected,res):
      if not res:
      res = 'None'
      #print(errmsg+res)
      if not expected == res and not res == 'None':
      raise SIM800LError('SIM800L Error {} {}'.format(errmsg,res))

      class SIM800L:

      def __init__(self,uartno):  # pos =1 or 2 depending on skin position
          self._uart = pyb.UART(uartno, 9600, read_buf_len=2048)
          self.incoming_action = None
          self.no_carrier_action = None
          self.clip_action = None
          self._clip = None
          self.msg_action = None
          self._msgid = 0
          self.savbuf = None
          self.credit = ''
          self.credit_action = None
          
      def callback_incoming(self,action):
          self.incoming_action = action
      
      def callback_no_carrier(self,action):
          self.no_carrier_action = action
      
      def callback_clip(self,action):
          self.clip_action = action
      
      def callback_credit_action(self,action):
          self.credit_action = action
      
      def get_clip(self):
          return self._clip
          
      def callback_msg(self,action):
          self.msg_action = action
      
      def get_msgid(self):
          return self._msgid
      
      def command(self, cmdstr, lines=1, waitfor=500, msgtext=None):
          #flush input
          #print(cmdstr)
          while self._uart.any():
              self._uart.readchar()
          self._uart.write(cmdstr)
          if msgtext:
              self._uart.write(msgtext)
          # if waitfor>1000:
          #    pyb.delay(waitfor-1000)
          buf=self._uart.readline() #discard linefeed etc
          #print(buf)
          buf=self._uart.readline()
          #print(buf)
          if not buf:
              return None
          result = convert_to_string(buf)
          if lines>1:
              self.savbuf = ''
              for i in range(lines-1):
                  buf=self._uart.readline()
                  if not buf:
                      return result
                  #print(buf)
                  buf = convert_to_string(buf)
                  if not buf == '' and not buf == 'OK':
                      self.savbuf += buf+'\n'
          return result
      
      def setup(self):
          self.command('ATE0\n')         # command echo off
          self.command('AT+CRSL=99\n')   # ringer level
          self.command('AT+CMIC=0,10\n') # microphone gain
          self.command('AT+CLIP=1\n')    # caller line identification
          self.command('AT+CMGF=1\n')    # plain text SMS
          self.command('AT+CALS=3,0\n')  # set ringtone
          self.command('AT+CLTS=1\n')    # enabke get local timestamp mode
          self.command('AT+CSCLK=0\n')   # disable automatic sleep
          
      def wakechars(self):
          self._uart.write('AT\n')        # will be ignored
          # pyb.delay(100)
      
      def sleep(self,n):
          self.command('AT+CSCLK={}\n'.format(n))
              
      def sms_alert(self):
          self.command('AT+CALS=1,1\n')  # set ringtone
          # pyb.delay(3000)
          self.command('AT+CALS=3,0\n')  # set ringtone
      
      def call(self,numstr):
          self.command('ATD{};\n'.format(numstr))
          
      def hangup(self):
          self.command('ATH\n')     
          
      def answer(self):
          self.command('ATA\n')
      
      def set_volume(self,vol):
          if (vol>=0 and vol<=100):
              self.command('AT+CLVL={}\n'.format(vol))
      
      def signal_strength(self):
          result = self.command('AT+CSQ\n',3)
          if result:
              params=result.split(',')
              if not params[0] == '':
                  params2 = params[0].split(':')
                  if params2[0]=='+CSQ':
                      x = int(params2[1])
                      if not x == 99:
                          return(math.floor(x/6+0.5))
          return 0
          
      def battery_charge(self):   
          result = self.command('AT+CBC\n',3,1500)
          if result:
              params=result.split(',')
              if not params[0] == '':
                  params2 = params[0].split(':')
                  if params2[0]=='+CBC':
                      return int(params[1])
          return 0
          
      def network_name(self):   
          result = self.command('AT+COPS?\n',3)
          if result:
              params=result.split(',')
              if not params[0] == '':
                  params2 = params[0].split(':')
                  if params2[0]=='+COPS':
                      if len(params)>2:
                          names = params[2].split('"')
                          if len(names)>1:
                              return names[1]
          return ''
      
      
      def read_sms(self,id):
          result = self.command('AT+CMGR={}\n'.format(id),99)
          if result:
              params=result.split(',')
              if not params[0] == '':
                  params2 = params[0].split(':')
                  if params2[0]=='+CMGR':
                      number = params[1].replace('"',' ').strip()
                      date   = params[3].replace('"',' ').strip()
                      time   = params[4].replace('"',' ').strip()
                      return  [number,date,time,self.savbuf]
          return None
      
      def send_sms(self,destno,msgtext):
          result = self.command('AT+CMGS="{}"\n'.format(destno),99,5000,msgtext+'\x1A')
          if result and result=='>' and self.savbuf:
              params = self.savbuf.split(':')
              if params[0]=='+CUSD' or params[0] == '+CMGS':
                  return 'OK'
          return 'ERROR'
      
      def check_credit(self):
          self.command('AT+CUSD=1,"*100#"\n')
      
      def get_credit(self):
          return self.credit
      
      def delete_sms(self,id):
          self.command('AT+CMGD={}\n'.format(id),1)
                       
      def date_time(self):
          result = self.command('AT+CCLK?\n',3)
          if result:
              if result[0:5] == "+CCLK":
                  return result.split('"')[1]
          return ''
          
      def check_incoming(self): 
          if self._uart.any():
              buf=self._uart.readline()
              # print(buf)
              buf = convert_to_string(buf)
              params=buf.split(',')
              if params[0] == "RING":
                  if self.incoming_action:
                      self.incoming_action()
              elif params[0][0:5] == "+CLIP":
                  params2 = params[0].split('"')
                  self._clip = params2[1]
                  if self.clip_action:
                      self.clip_action()
              elif params[0][0:5] == "+CMTI":
                  self._msgid = int(params[1])
                  if self.msg_action:
                      self.msg_action()
              elif params[0][0:5] == "+CUSD":
                  if len(params)>1:
                      st = params[1].find('#')
                      en = params[1].find('.',st)
                      en = params[1].find('.',en+1)
                      if st>0 and en>0:
                          self.credit = '£'+params[1][st+1:en]
                          if self.credit_action:
                              self.credit_action()
              elif params[0] == "NO CARRIER":
                      self.no_carrier_action()
      
      
      # http get command using gprs
      def http_get(self,url,apn="giffgaff.com"):
          resp = None
          rstate = 0
          proto, dummy, surl = url.split("/", 2)
          is_ssl = 0
          if  proto == "http:":
              is_ssl = 0
          elif proto == "https:":
              is_ssl == 1
          else:
              raise ValueError("Unsupported protocol: " + proto)
          try:
              # open bearer context
              res = self.command('AT+SAPBR=3,1,"Contype","GPRS"\n')
              check_result("SAPBR 1: ",'OK',res)
              res = self.command('AT+SAPBR=3,1,"APN","{}"\n'.format(apn))
              check_result("SAPBR 2: ",'OK',res)
              res = self.command('AT+SAPBR=1,1\n',1,2000)
              check_result("SAPBR 3: ",'OK',res)
              # now do http request
              res = self.command('AT+HTTPINIT\n',1)
              check_result("HTTPINIT: ",'OK',res)
              res = self.command('AT+HTTPPARA="CID",1\n')
              check_result("HTTPPARA 1: ",'OK',res)
              res = self.command('AT+HTTPPARA="URL","{}"\n'.format(surl))
              check_result("HTTPPARA 2: ",'OK',res)
              res = self.command('AT+HTTPSSL={}\n'.format(is_ssl))
              check_result("HTTPSSL: ",'OK',res)
              res = self.command('AT+HTTPACTION=0\n')
              check_result("HTTPACTION: ",'OK',res)
              for i in range(20):  #limit wait to max 20 x readline timeout
                  buf = self._uart.readline()
                  if buf and not buf==b'\r\n':
                      buf = convert_to_string(buf)
                      #print(buf)
                      prefix,retcode,bytes = buf.split(',')
                      rstate = int(retcode)
                      nbytes = int(bytes)
                      break
              res = self.command('AT+HTTPREAD\n',1)
              buf = self._uart.read(nbytes)
              check_result("HTTPACTION: ",'+HTTPREAD: {}'.format(nbytes),res)
              if buf[-4:] == b'OK\r\n':  # remove final OK if it was read
                  buf = buf[:-4]
              resp = Response(buf)
          except SIM800LError as err:
              print(str(err))
          self.command('AT+HTTPTERM\n',1) # terminate HTTP task
          self.command('AT+SAPBR=0,1\n',1) # close Bearer context
          return resp
      
      
      def test(self):
          r = self.http_get('http://exploreembedded.com/wiki/images/1/15/Hello.txt')
          print(r.text)
      

      class Response:

      def __init__(self, buf, status = 200):
          self.encoding = "utf-8"
          self._cached = buf
          self.status = status
      
      def close(self):
          self._cached = None
      
      @property
      def content(self):
          return self._cached
      
      @property
      def text(self):
          return str(self.content, self.encoding)
      
      def json(self):
          import ujson
          return ujson.loads(self.content)        
      

      phone = SIM800L(1)
      print(phone.signal_strength())

      posted in UIFlow
      E
      Efried