micropython IDE for linux on PC

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
katesfb
Posts: 22
Joined: Sun Dec 18, 2016 8:09 pm

micropython IDE for linux on PC

Post by katesfb » Sun Jan 15, 2017 9:12 pm

Hi,
I am new to micropython and the pyboard (i come from a arduino background). I have a had a bit of a play with it via the getting started tutorial and i think its fantastic and could easily replace a lot of the stuff i currently do with arduino.

Is there a micropython IDE that would run under linux on the PC?

Any help is much appreciated.

Cheers.

jpj
Posts: 55
Joined: Sat Dec 10, 2016 3:07 pm

Re: micropython IDE for linux on PC

Post by jpj » Sun Jan 15, 2017 9:50 pm

Welcome to MicroPython!

There is no IDE as there is with Arduino. You can ether enter micropython code interactively through the REPL after connecting with something like "screen" or write program files locally to be copied to the micro-controller's filesystem.

If you want something a little more interactive than the basic REPL while using Python in the Linux environment check out IDLE and iPython.

What micro-controller(s) are you running MicroPython on?

Regards,
J

p.s. If you haven't done so already, check out some of these MicroPython tutorial videos:

https://learn.adafruit.com/category/micropython

katesfb
Posts: 22
Joined: Sun Dec 18, 2016 8:09 pm

Re: micropython IDE for linux on PC

Post by katesfb » Thu Jan 19, 2017 4:06 am

Hi,
And thanks for the reply.

I agree that you dont neccesarily need a fully flegded IDE however i did fnd something called pymakr (https://www.pycom.io/solutions/pymakr/) which looks quite good.

Currently running micropython on the standard pybaord V1.1. and i think its a really impressive peice of kit.

I have couple of other questions:
1) With the uart class is it possible to flush the buffer as can be done with the arduino hardware uart.
2) With the uart class is there a way of dealing with true TTL level RS232. we are currently testing a system that uses the pybaord to log data from an ultrasonic sensor that ouputs the data as TTL level RS232 but we are getting garbage comming through so i assume that the data stream is inverted - is there a way to deal with this stream.
3) Is there a micropython equivalant to the python ftplib?

Any help is much apreciated.

Cheers.

User avatar
pythoncoder
Posts: 3935
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: micropython IDE for linux on PC

Post by pythoncoder » Thu Jan 19, 2017 7:07 am

Assuming you're talking about the read buffer the UART read method will flush it. However it won't return until the timeout has elapsed, so you may want to set the timeout to a small value, issue a read, then set it back.

Inverted TTL sounds like an odd way to do it, and there are more common ways of getting garbage out of a UART ;) First be sure you have baudrate, bits per character and parity set correctly.

Have you checked the voltage on the device's data out line when it is idle? If it idles at 0V then it is indeed inverted. There are two options. One is to use a TTL inverter chip to invert the incoming and outgoing signals. The other is to use the Pyboard to do it. You can implement an inverter with an input pin and an output pin. You'll need an interrupt handler for the input pin which sets the state of the output pin to the complement of the input.

As for FTP @roberthh has written a server, but I don't know if anyone has done a client. A forum search might yield one. There doesn't seem to be one in the official MicroPython library.
Peter Hinch

lbattraw
Posts: 21
Joined: Sun May 10, 2015 11:35 am

Re: micropython IDE for linux on PC

Post by lbattraw » Thu Jan 19, 2017 12:21 pm

katesfb wrote: 2) With the uart class is there a way of dealing with true TTL level RS232. we are currently testing a system that uses the pybaord to log data from an ultrasonic sensor that ouputs the data as TTL level RS232 but we are getting garbage comming through so i assume that the data stream is inverted - is there a way to deal with this stream.
Hiya,

In regards to #2 you could also use a NPN transistor and two resistors as an inverter, it's at least a little less of a waste as opposed to using a 74LS04/4049 hex inverter chip (Which would also require you to tie all unused inputs high/low to avoid unstable oscillation). Here's an Instructable that shows you how to use a single NPN transistor to control a LED (You should use a red LED since they have the lowest drop-out voltage, though you actually don't need an LED at all) which also serves to invert the input signal. --Just use the connection from the transistor (Called the collector) to the LED as your output and the connection to the base via the resistor as your input, connected to your ultrasonic sensor. Just be sure to connect things labeled as +5V in the diagram to the +3.3V supply on your Pyboard instead, since I don't think the Pyboard is 5V-tolerant. I'd also like to add the resistor values are very non-critical and you could probably use any value from 470 to 10K ohms for both resistors, though you probably want to use similar values for both of them (1K would be perfect, for example).
My apologies if you're already familiar with with these types of components, I wanted to be sure and try to explain things.

http://www.instructables.com/id/Logic-G ... ansistors/

Best wishes-
Larry

User avatar
pythoncoder
Posts: 3935
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: micropython IDE for linux on PC

Post by pythoncoder » Thu Jan 19, 2017 4:35 pm

Unused inputs on a 74LS04 can be left open. CMOS chips require them to be tied.

But I'd definitely make sure the signal really is inverted before launching into any of these solutions. It sounds a curious device if it is.
Peter Hinch

katesfb
Posts: 22
Joined: Sun Dec 18, 2016 8:09 pm

Re: micropython IDE for linux on PC

Post by katesfb » Sun Jan 22, 2017 7:25 pm

Hi,
And thanks for you replies - i will try the possible solutions and let you know how i get on.

Cheers.

katesfb
Posts: 22
Joined: Sun Dec 18, 2016 8:09 pm

Re: micropython IDE for linux on PC

Post by katesfb » Mon Jan 23, 2017 3:36 am

Hi,
Re ultrasonic sensor:
The unit is an maxbotix mb7360 and the data sheet indicates the following;
The sensor has an RS232 data format (with 0V to Vcc levels) The output is an ASCII capital "R" followed by 4 ASCII character digits representing the range in mm followed by a cariage return (ASCII 13). The serial data format is 9600-8-N-1. The output runs at 7.5HZ i.e 7.5 values per second in free running mode.

I tested it using a 3.3v arduino baord and it read the data stream correctly on the hardware serial port and output the correct information however i had to use the "true" option for the serial input and the data sheet indicates that the idle state for the rs232 output is low so am i correct to assume this means i will have to use some form of rs232 converter with the pyboard? If so i will try the aproach mentioned above.

Re FTP:
If there is no ftp library i assume the only option is to use the AT commands directly to do ftp transfers - i have tried this using the pyboard connected to a sim900 modem and it works fine to upload file/data to a cloud server but a library just makes things simpler and quicker.

Any help is much apreciated.

Cheers.

User avatar
pythoncoder
Posts: 3935
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

RS232

Post by pythoncoder » Mon Jan 23, 2017 7:54 am

The term "RS232" is much abused because it comprises a protocol and an electrical specification. True RS232 operates at (IIRC) +12V and -12V logic levels for long distance communication. An RS232 converter chip converts between 0-5V and those levels.

Devices under discussion use the RS232 protocol but TTL logic levels. It does sound like your device uses inverted logic. So your converter, however implemented, needs to work at those levels (e.g. the 74LS04 suggested below).
Peter Hinch

katesfb
Posts: 22
Joined: Sun Dec 18, 2016 8:09 pm

Re: micropython IDE for linux on PC

Post by katesfb » Tue Jan 24, 2017 3:37 am

Hi,
And thanks for the reply - yes an r232 converter did the trick - i am now getting the correct information back. Thanks for all your help.

Did you come across any further information on the ability of micropython to do FTP? Is it worth putting this up as a separate question on the forum?

Cheers.

Post Reply