Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    LoPy on corporate WiFi and using Tx/Rx commands **SOLVED**

    Scheduled Pinned Locked Moved LoPy
    lopywifiuartsolved
    23 Posts 5 Posters 7.8k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      jmarcelino @joena
      last edited by

      @joena

      To add to @bucknall's reply, the UART connections will give you 3.3 volt level serial however true RS-232 - what most projectors expect - use up to +15/-15V levels so you'll need an extra driver chip like the MAX3232.

      If you look on Ebay you can find many cheap MAX3232 modules. Then connect your LoPy UART to those and from there to your projector.

      J 2 Replies Last reply Reply Quote 1
      • J Offline
        joena @bucknall
        last edited by

        @bucknall

        Hi bucknall, thx so much for your quick answer/response. Yes i want to control the projector with the LoPy ;-) for now Tx signals/commands are great, if all works out I want to implement Rx to read out projector status, like lamp hours, on/off status, etc.

        Your response looks promising .. I will implement it tomorrow at work (I just got out of work ;-))

        I will let you/the community know if it worked :-) thx for now, Jeroen

        1 Reply Last reply Reply Quote 0
        • J Offline
          joena @jmarcelino
          last edited by

          @jmarcelino

          Aah thx jmarcelino, I will keep this in mind. Thx for this pointer, jeroen

          http://www.radio-electronics.com/info/telecommunications_networks/rs232/signals-voltages-levels.php

          I learned something today :-)

          1 Reply Last reply Reply Quote 0
          • J Offline
            joena @jmarcelino
            last edited by joena

            @jmarcelino alt text

            Something like this jmarcelino? The VCC would be the 3.3Vout of the LoPy. The chip is the MAX3232.

            Grts, Jeroen

            J 1 Reply Last reply Reply Quote 1
            • J Offline
              jmarcelino @joena
              last edited by

              @joena
              yes that should do it!

              Let us know how it goes :)

              J 1 Reply Last reply Reply Quote 0
              • J Offline
                joena @jmarcelino
                last edited by

                @jmarcelino
                @bucknall

                Just to inform, i will be testing it not today, but tomorrow (today I've ordered the max3232 unit), hope it arrives tomorrow ;)

                1 Reply Last reply Reply Quote 0
                • J Offline
                  joena
                  last edited by joena

                  Totday the MAX3232 breakout box arrived and serial data is succesfully sent to the rs232 port :-) So great (I used a free dataviewer tool, from Extron to check this). Only one question:
                  I can sent the ASCII Power ON commando, but after each command I have to sent the execute code to the projector, this is the hex command: %0D (for our type projector). What syntax in python is correct to accomplish this? I used these lines:

                  from machine import UART
                  lcd_projector = UART(1)
                  lcd_projector.init(9600, bits=8, parity=None, stop=1)
                  lcd_projector.write('POWR 1')

                  I can see the correct code (if I use the data viewer), but the problem is that the code isn't executed. Can I use ASCII and HEX in one line??

                  If I hard code append it, the projector sees this as a sort of variable/string.. This is not correct

                  Grts, Jeroen

                  L 1 Reply Last reply Reply Quote 0
                  • L Offline
                    livius @joena
                    last edited by

                    @joena

                    to write letters e.g. "HI"

                    uart.write(bytes([0x48,0x49]))
                    

                    think about people first, then computers

                    J 1 Reply Last reply Reply Quote 0
                    • J Offline
                      jmarcelino @livius
                      last edited by jmarcelino

                      The way @livius wrote is the most generic way but because 0x0D is a carriage return in ASCII you can just use \r at the end of the string.

                      1 Reply Last reply Reply Quote 0
                      • J Offline
                        joena
                        last edited by joena

                        Hi livius, Hi jmarcelino,

                        Thx for your tips... Great news (at least for me ;-)), the first step in my end goal is working :-)

                        alt text

                        It is now possible for me to turn on a projector (or any other command(s)) via WiFi using the LoPy and the MAX3232 board.

                        For reference and other people interested this is the code for main.py... (boot.py is unaltered)

                        from machine import UART
                        projector = UART(1)
                        projector.init(baudrate=9600, bits=8, parity=None, stop=1)
                        projector.write('POWR 1\r')

                        from machine import Pin
                        led = Pin("G16", mode=Pin.OUT)
                        button = Pin("G17", mode=Pin.IN, pull=Pin.PULL_UP)

                        while True:
                        led(button())

                        Next step will be:

                        • A (couple of) button(s) hard wired directly to the LoPy to give more functionality.
                        • Read out projector status (lamp hours, active input, etc.) and doing something with this info.
                        • Implement the LoPy on the corporate open WiFi network and finding the LoPy back.
                        • Using LoRa instead of WiFi in a point-to-point configuration (I preferer this over WiFi).
                        • Design/program a webbased managing tool to control lots (max 100) devices.
                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          DDA @joena
                          last edited by

                          @joena
                          I have two of those MAX3232 modules and its not working, I initially thought I had it figured out. So to test further I have the MAX3232 breakout box powered by the Expansion boards 2.0 VCC and GND, which would be 3.3VDC. Then I looped the TX and RX as loop back on the module with no Pycom unit, and connected to my PC's COM port. When I send an escape or other character I see a flicker on the TX and RX LED on the breakout board but no loop back response on my TeraTerm terminal, which is set to 9600, 8,none,1. What seems to be wrong, I tried both my MAX3232 modules from amazon...same result.
                          https://www.amazon.com/gp/product/B01JYNHNW6/ref=oh_aui_detailpage_o04_s00?ie=UTF8&psc=1
                          Thank you.

                          J 1 Reply Last reply Reply Quote 0
                          • J Offline
                            jmarcelino @DDA
                            last edited by

                            @dda
                            Vcc (do you mean Vin?) on the expansion board is actually 5V. You need a Pycom module (WiPy, LoPy, etc) to regulate that into 3.3V on the separate 3V3 pin.

                            D 2 Replies Last reply Reply Quote 0
                            • D Offline
                              DDA @jmarcelino
                              last edited by DDA

                              @jmarcelino
                              I meant, I used the Vout of the expansion board(3.3VDC) and GND to power the MAX3232 break out board, it has a LoPy plugged in with no code( os.mkfs was used to make sure its not running any)...the expansion board is powered via the USB port. I can see the breakout board is receiving 3.3VDC.

                              J 1 Reply Last reply Reply Quote 0
                              • J Offline
                                jmarcelino @DDA
                                last edited by jmarcelino

                                @dda
                                Ok maybe I misunderstood what you meant by “with no Pycom unit”, but if you really have no Pycom module you will not have 3.3V from the expansion board alone (other than perhaps some parasitic powering from the Tx/RX pins)

                                D 2 Replies Last reply Reply Quote 0
                                • D Offline
                                  DDA @jmarcelino
                                  last edited by

                                  @jmarcelino
                                  Also, I made sure my echo is ON, on my PC. When I manually short DB9 connectors( Com1) pin2 & 3 without the breakout MAX3232 board, any character I send is echoed back on to my TeraTerm terminal. When I connect the same DB9 to my breakout board and short the Tx and Rx on the MAX3232 which is powered via the expansion with LoPy no loopback echo is observed. Lopy is just there to make the voltage out of the expansion 2.0 functional.

                                  1 Reply Last reply Reply Quote 0
                                  • D Offline
                                    DDA @jmarcelino
                                    last edited by

                                    @jmarcelino
                                    Sorry for the confusion, when I meant with no Pycom unit I meant I was not using the Pycom modules for communication test with the MAX3232....the PC's COM port and Tera term is being used for initail MAX3232 communication test . The expansion 2.0 board has a Lopy plugged with no code, to make sure the expansion board spits out the Vout of 3.3VDC. Once I verify the MAX3232 communication functionality, I will add the LoPy to the communicate with third part UART communication

                                    1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      DDA @jmarcelino
                                      last edited by

                                      @jmarcelino
                                      [Solved ]
                                      Resolved, used a different power supply unit and it worked. I guess even though I was getting enough juice of 3.3VDC out of the Expansion board with a LoPy current was not enough.
                                      Thanks much!

                                      1 Reply Last reply Reply Quote 0

                                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                      With your input, this post could be even better 💗

                                      Register Login
                                      • 1
                                      • 2
                                      • 2 / 2
                                      • First post
                                        Last post

                                      Pycom on Twitter

                                      Pycom