#microcontrollers

1 messages Β· Page 13 of 1

hallow igloo
#

Heyo, i was referred here for a topical question. I have an ESP8266, and im using a micropython IDE to talk to it, is there a way to have the ESP8266 create multiple wifi networks at once?

#

here is code:

#
def create_networks(amount):
    for i in range(0,int(amount)):
        ap = network.WLAN(network.AP_IF)
        ap.active(True)
        ap.config(essid=wifiNameList[num])
#

The result of this code is that it makes only one network and just keeps renaming it

open dock
#

@hallow igloo I don't think that the ESP8266 (or ESP32) can advertise/support multiple SSIDs at once. what are you trying to accomplish?

hallow igloo
#

multiple networks a test

open dock
#

and the test subject is an external something that automatically scans/connects?

hallow igloo
#

mainly doing to test capabilities of the ESP8266

open dock
#

the only way i could see that working, is to store state information in an object/file, set an SSID, run test(s), and then move to the next SSID.

hallow igloo
#

i see

#

final question: what is the recommended method to generate a random number between two other numbers in micropython?

#

the random module isn't included and the only options give you bytes

open dock
#

give me a sec. i'm more versed in CircuitPython than uPython...

hallow igloo
#

Aight

open dock
hallow igloo
#

err no

#

i'll install that

#

yeah i dunno how to install that

open dock
#

doh. my bad, i seemed to have skimmed over this note:

Note that the main target of micropython-lib is a "Unix" port
hallow igloo
#

ah

open dock
#

i think the uPy API docs are somewhat out of date. there is a urandom module in the repo, which also includes randrange. haven't checked if its included in the ESP8266 port, but you could try this:

import urandom
print(urandom.randrange(0, 10))
#

and, appears to be turned on for the 8266...

#define MICROPY_PY_URANDOM          (1)
hallow igloo
#

nah doesn't work

#

"module" object has no attribute "randrange"

open dock
#

what does dir(urandom) print out?

hallow igloo
#

['__class__', '__name__', 'getrandbits', 'seed']

open dock
#

are you using the latest version?

hallow igloo
#

yes

open dock
#

πŸ€”

hallow igloo
#

i downloaded the latest .bin today

#

welp i gtg now

#

thanks your for your help

open dock
#

πŸ‘‹ you're welcome. looking at urandom again, it looks like there's an extra conditional that include/excludes randrange. which i assume excludes it on the ESP8266. 😦

tulip comet
#

if i'm understanding correctly, getrandbits should be able to generate a random number with a given amount of bits. you could write your own randrange function. i think you could get the difference between the two input numbers and figure out how many bits that number uses (i'm not sure if int.bit_length is available on micropython but it should still be quite easy to do yourself if necessary). then, using getrandbits, generate a random number with that amount of bits. then you could use modulo to clamp it within range or keep generating until it is in range if you're looking for a more uniform distribution. i'm not sure if i explained that well so have an example instead:

#

say i want a random number between 5 and 14. the difference is 8 (if we're going in terms of randrange), which occupies 4 bits (0b1000) so if i generate a number with 4 bits using getrandbits i can get a random number up to 0b1111 or 15. you could then do that number % 8 to keep it within the difference, or generate another random number until you get one below your difference 8 for a better uniform distribution. then, add this random number onto your minimum number (in this case, 5) and you've got yourself a random number in the range you wanted.

maybe that's obvious and i didn't need to explain it at all, i don't know. i'm tired :D

patent barn
#

@tulip comet you typed this at 5:16

#

Have you slept? at all?

tulip comet
#

i wish i did

patent barn
#

God dammit Juan

#

GOD DAMMJT

tulip comet
#

hey i'm just forcing my sleep schedule back to normal, holidays end soon. also, offtopic. off_topeek

vague crane
lean valve
#

Ooh.

#

@tulip comet you got a shoutout in the credits for that ^

long orbit
#

πŸŽ‰

tulip comet
#

oh neat :D

patent barn
#

@tulip comet credits of what?

hallow igloo
#

Has anyone installed asyncpg on raspbian before

lean valve
#

@hallow igloo I have not, but I have a raspi on raspbian at home, which I can check it against if you are running into a problem

stuck thicket
stuck thicket
hallow igloo
#

I got PostgreSQL on my PC with my database and i've got my python discord bot on my raspberry pi. When I try run the bot it wont connect to my database

lean valve
#

can you ping your PC from the Pi, and is it firewalled off on the PC?

hallow igloo
#

?

languid hill
#

there are multiple things that can get in the way of connecting to a remote database:

  1. improper network settings that make it so you cant route packets to the server
  2. firewall settings blocking the ports
  3. improper db config that causes it to not be listening on the network (eg maybe its only listening for processes on the db server itself)
  4. permissions on the db server blocking access from your machine
  5. username/password is wrong
  6. your software's connection information like IP/port/protocol is wrong
  7. your code is not correctly using the postgres library
    etc
#

@hallow igloo you should check all of those above things

hallow igloo
#

i created a dump file

#

i cant seem to get pg_restore to work on my pi

#

im moving my databse to my pi btw

#

How effective would it be to be to make a Discord bot with Python and then just have it running on a Raspberry Pi so I don't have to constantly have my pc running?

#

once i get my database working ill let u know

#

im trying to move my database to my pi

#

so ill be running my bot and db on my pi

hallow igloo
#

Okat

#

Okay

lean valve
#

@hallow igloo That would work fine

hallow igloo
#

Okay thanks!! πŸ˜ƒ

tawny fiber
#

so ive looked slightly into circuitpython and I got a question. Why is it designed to actually still parse etc. the .py files instead of the user just compiling it down into a .pyc and then copying it over. Wouldnt that reduce the memory and/or flash required for the circuitpython binary (and the python script) making it easier to build bigger scripts?

open dock
#

@tawny fiber that is available, using the mpy-cross tool which converts files down into bytecode and gives them a .mpy extension. you can also freeze libraries in if you compile the firmware yourself, which will do the above.

tawny fiber
#

alright cool!

open dock
#

on the smaller capacity boards (M0), having your code in a .mpy, and then just importing it inside main.py/code.py is often the only way once you start running into memory errors. on the M4 boards...haven't seen anyone hit that limit. yet. πŸ˜„

halcyon iron
#

anyone knows where can i start learning about raspberry pi

lean valve
halcyon iron
#

oki doci thanks @lean valve πŸ˜ƒ

stuck thicket
stuck thicket
#

10% off all items in stock code is MAKECODE expires 5/1/19 @ 11:59pm ET #askanengineer https://youtu.be/dyFhE568-9Q & http://www.adafruit.com

Multistreaming with https://restream.io/ ----------------------------------------- LIVE CHAT IS HERE! http://adafru.it/discord Adafruit on Instagram: https:/...

β–Ά Play video
peak bridge
#

Hey, was wondering if anyone is good at Arduinos? I’m having trouble setting up my Ultrasonic sensor and buzzer to stop/play. What I have working currently is the ultrasonic sensor(it displays in cm the distance in serial port) and the buzzer(works when it reaches required distance). What I cannot get to work is stopping the music after it gets removed from the required distance. I have it so if they have their hand < 6 cm then it will play the song but I cannot figure out how to stop at > 6 because after the song starts to play, it doesn’t read distance to console anymore.

languid hill
#

you might set up an interrupt on a timer right before you start the music @peak bridge. keep the code in this interrupt super short so you cant hear the music pause and use it to check the sensors status

stuck thicket
opal mason
#

I always watch these back, but they're not in the right timezone for me, unfortunately

past epoch
#

is that the normal start time?

opal mason
#

It's usually somewhere between midnight and 2 am for me, as far as I can tell

#

Not surprising given the timezone they are in, though, so it's totally understandable.

peak bridge
#

Hello, I’m having a trouble with my ultrasonic sensor and my buzzer. I’m unable to stop the buzzer from playing a song mid song. I need help. I can share the code in a second

#

Thanks to anyone who will helpZ

#

.

rain pine
#

I got a PYNQ FPGA board, which has been awesome. It's plugged into my laptop with ethernet. I'd like it to be able to download packages. I saw that I'll have to Bridge my connection in order to do that, but I'd lose internet access on my laptop unless I "have a third network adapter that is also connected to the network or a static IP address ." Not sure how to do that last thing. Trying to follow this: https://www.windowscentral.com/how-set-and-manage-network-bridge-connection-windows-10

Windows Central

This guide will walk you through the steps to configure and manage a Network Bridge connection on Windows 10.

open dock
#

@peak bridge from looking at your code, the reason it won't stop "mid song" is because playmusic() is blocking code. once it is called, it won't exit the function until it has completed the for loop by iterating over the entire melody array. one approach to solve this is simply to move the iteration control outside of that function, and into your main loop(). i threw this together, which should work; though it may need some tweaking. https://paste.pythondiscord.com/enurozapav.py

peak bridge
#

Thank you so much @open dock I will try this.

open dock
#

yw. hope it works! 🀞

hallow igloo
#

So, I'm trying to host a webserver on a Raspberry pi. Anyone have any good tutorials to get started?

lean valve
#

That is not really Raspberry Pi specific, so you can use any tutorial for hosting a web server on Debian or Ubuntu (assuming you're using Raspbian)

bronze wasp
#

Does any one know anything about pymavlink?

lean valve
#

No, but I fly and that looks really interesting

finite furnace
#

Does anyone know if this SunFounder L293D Motor Drive Shield For Arduino Duemilanove Mega UNO R3 AVR ATMEL could be used to control three motors at a time?

#

Using a raspberry pi

past epoch
#

what kind of motor?

#

@finite furnace

finite furnace
#

DC brushed motor

past epoch
#

oh.. an arduino shield on an rpi?

finite furnace
#

I think it works

past epoch
#

you can run 4 dc motors on that shield

finite furnace
#

Otherwise would this be better: SB New DC and Stepper Motorshield for Raspberry Pi 3 and Raspberry Pi Zero this expansion board can control up to 4 DC motors or 2 Stepper Motor, 2 IR sensors and a single ultrasonic sensor.

past epoch
#

I cant say that using an arduino shield would work on an rpi, I feel like it would not.

#

im sure that later board cannot control 4 DC motors and two stepper motors,

#

think it would be able to do one or the other

finite furnace
#

But only 4 DC motors is what I need

#

So it would probably work

past epoch
#

I would go for the later suggestion then

finite furnace
#

Ok thanks

finite furnace
#

Does anyone have a recommendation for a quite cheap waterproof motor which is quite powerful- could be used in a boat? It would ideally also have a propellor.

heady crescent
#

you could always drive the propeller with a belt and not have to submerge the motor itself

#

(i have no recommendations though, just that thought)

hallow igloo
#

Is it worth buying a raspberry pi?

little gazelle
#

Highly depends on the plan you are having of course.

willow kernel
#

If nothing else it's a fun tinkering around tool

#

And you might end up finding a good project to do with it

finite furnace
#

I think a raspberry pi is a great buy if you are looking for another computer to play around with or do projects...

lyric oyster
#

i do have another question. is it possible to connect two grounds to my circuit? if i do it like this (foto below) my rpi crashes

languid hill
#

at what point does it crash? when you start the motor?

#

also 6 AAA batteries is 6v not 5, which could cause issues.

lyric oyster
#

when i plug the ground of the batteries it crashes

#

i watched a tutorial. there it worked with the battery but yeah maybe you are right

languid hill
#

do you have another power source then?

#

because for it to crash it has to be already running

#

right now you have the + AND - of the batteries connected to the pi

#

if the pi ALSO has another power source then yes that will cause issues

#

you need to keep their + separated

#

@lyric oyster tagging you since i think its been a while since you posted last

lyric oyster
#

sounds fair :D its already late here. i will try it tomorrow but thanks for your help!

sturdy ridge
#

@languid hill @lyric oyster for reference, Arduinos have an on board voltage regulator which you should be providing a minimum 7V, probably closer to 8-9 V

#

Oh that's a pi lmao nvm

#

The best way to power is pi is almost certainly a portable power bank

#

You really shouldn't be using AA batteries for powering pis

#

They don't provide constant voltages, they have a wildly varying voltage sag curve as they discharge

#

This means you'll eventually get brownouts even if at some point you're putting in the perfectly in-spec input voltage

#

Unless you're using a 5V switching converter

#

But as I said, just use a power bank, it's easier

lyric oyster
#

the batteries are for the motors. not the pi. the pi is powered by a 5v adapter

sturdy ridge
#

Ah motors are far less sensitive to voltage choice, should be fine

#

I'd help debug but I refuse to read wiring diagrams

lyric oyster
#

πŸ˜‚

sturdy ridge
#

Bring me a schematic and I'll help

lyric oyster
#

i am already in bed but thanks!

#

and the batteries are just for testing purposes. later on i will use an accu which needs to power 3 6v motors

languid hill
#

yeah if you have a 5v supply for the pi and a 6v supply for the motors, then connecting their + AND - will result in issues

#

just connect the -

lyric oyster
#

tbh that sounds logical. i should have fixed that myself. thanks so much

stuck thicket
stuck thicket
bronze wasp
#

@lean valve Yeah if you get that and pair it with a pixhawk you can do a lot

#

But pymavlink is so hard to work with

#

I was looking at their source code and they have a lot of ```
try:
code()
except Exception as e:
pass

lean valve
#

πŸ™ˆ

#

That's my pet peeve.

bronze wasp
#

Which means when it doesn't work you don't get any errors and it's very annyoing to debug

#

I am working on a fork that fixes this issue

lean valve
#

I like to link it to people who do that

bronze wasp
#

Yeah

#

I usally link poeple this video

#

I haven't seen that before, but I've seen a lot of anti-patterns articles before

tawny fiber
#

I showed that one to my mom once (she's been working on a huge C codebase from the late 80s since the 90s) and she was nodding in full agreement on every antipattern, always coming up with examples from her work

#

I think this was the first yt video she thought was worthy enough to show her friends

lean valve
#

But why is it presented as part of the Guy Talking In Car genre of youtube video

#

extremely weird choice imo

bronze wasp
#

The guy is troll, but still manages to get his message across

tidal wedge
#

hi guys how can i connect 3 buttons in this configuration?

humble kraken
#

connect one side of all of them to ground

#

connect their other sides to different IO lines

#

you can have the resistor in the ground line

tidal wedge
#

Is there a diagram to follow? I'm not very sure about how to do that

patent barn
#

I don't know if this is the right place... Right now my LCD 5" screen has a power button at the back.

#

This is very annoying, so I am trying to get the software to do this for me

#

Its just getting power from the GPIO pins. So how do I shut them all down, and turn them back on>

tidal wedge
#

@humble kraken

humble kraken
tidal wedge
#

how are the buttons off the breadboard

#

This what I got rn

humble kraken
#

i didnt draw a breadboard because that would be too much work

tidal wedge
#

yh its just hard to understand completely cos im not too familiarr with hardware

humble kraken
#

have all the button resistors go to the ground rail at the bottom of the board

#

same as the leds

#

wait

#

oh they're wired as pullup

#

connect the 3v3 pin to the red rail on the breadboard

#

then connect all the resistors to the red (power) rail

humble kraken
tidal wedge
#

thank you

#

πŸ˜ƒ

stuck thicket
stuck thicket
tidal wedge
#

@humble kraken do i connect the male to female connector next to the switch?

tidal wedge
#

i connected the 3v3 to the red rail and it corrurpted my sd card

#

cheers πŸ˜„

humble kraken
#

i have no idea how that's supposed to happen S:

#

@tidal wedge although sd card corruption seems to be a very common issue on Pis in general

#

shorting a pin or a similar hardware issue and somehow corrupting bits on a sd card don't really seem relatable though. Lots of worse stuff should be happening before those two events are directly related

lean valve
#

A new episode of Podcast.__init__ just came out, focusing on CircuitPython!

#

Nice work @long orbit , I'm gonna go listen to it now on my walk

opaque compass
#

Ive got a really weird question. I want to program an ai to learn fingerprint security and such mainly because i just want a project to do over the summer. I am curious if there is a simple cheap fingerprint reader for pc or if there is a way for my old ipad’s fingerprint reader information to be sent to my pc

#

Essentially using the ipad as a fingerprint reader

sturdy ridge
#

nope cant use ipad

#

there's probably cheap fingerprint readers. have you tried looking?

opaque compass
#

Yes but ive found some interesting results

#

Ill just buy one online since the ipad doesn’t work

#

Ty sir

long orbit
#

Thanks @lean valve ! I hope it turned out ok. I haven't had a chance to listen yet.

vague crane
#

So we could have had CircuitPerl πŸ˜‚

lean valve
#

😬

steel aurora
#

oh, sweet! can't wait to listen to the dulcet tones of @long orbit

#

added to my list for tomorrow

long orbit
#

πŸ˜ƒ

jade orchid
#

Nice podcast. I properly discovered the circuitpython specificities. I recently build a project with micropython without even giving circuitpython a proper look. I'll stick to micropython for now (I' come from embeded c programming and use esp board I already had) but it's nice to know a more beginner friendly option to recommand around.

steel aurora
#

great podcast

long orbit
#

Thanks @steel aurora ! @jade orchid I’m glad you are liking micropython!

steel aurora
#

oh hey I'm mister shirt look at me

stuck thicket
opal mason
#

"We want the tree to be able to fire off tacos in any direction" πŸ˜„

#

Oh, cool, CircuitPython day at 8-8-2019

#

We should do something with that here as well

vocal cipher
#

Hello great Hackers

#

does this channel support AVR mcu and arduino too or n.ot?

sturdy ridge
#

@vocal cipher JustAsk

vocal cipher
#

yes

#

I am only asking to see if i found channel that has members who can help me with the things confusing me in future @sturdy ridge

sturdy ridge
#

if it's not Python related, people here probably cant help large amounts. there's always discords like Electronicity, Discord Electronics Server and the Adafruit discord servers if it's less python related or the Electrical engineeing server if it's less arduino/hobbyist stuff

vocal cipher
#

oohm i see now

#

TY πŸ˜ƒ

main tiger
#

I am designing a custom ATSAMD51 M4 PCB and plan to program in CircuitPython. My hardware question is: Does my design need an external FLASH IC for the UF2 Bootloader feature to operate correctly?

sturdy ridge
#

I havent loaded custom bootloaders before but I dont see why you'd need it. seems to be the process is simply bossa flash the bootloader

main tiger
#

So if a new ATSAMD51 M4 was plugged in and no external flash was present the bootdrive that would show up in windows would be the internal FLASH on the new ATSAMD51 ?

open dock
main tiger
#

Perfect, I am trying to keep my chip count down.

eager agate
#

hi

#

i have a arduino

#

haha

silver surge
lean valve
#

Nicely done.

silver surge
#

ok after some help from the folks in adafruit with some stability enhancements a version is available on the APM

hallow igloo
#

Hey there, could someone help me? I used micro python with ESP8266 board. How do i use urequest module and what is the difference between it and urllib.request that exist in normal python? I couldn't find sources at Google because it's really specific

#

So i could get bytes HTML data from a link.

jade orchid
#

@hallow igloo The u* in urequest indicates library specificly writen for micropython. Also be aware that they sometimes implement only a portion of the standard equivalent library. You should prefer u* lib as possible as they are implemented with the microcontroller constraint. You can have a look at https://github.com/micropython/micropython-lib/tree/master/urequests for urequest, there is a small exemple.

hallow igloo
#
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "urequests.py", line 106, in get
  File "urequests.py", line 56, in request
OSError: -2```
#

@jade orchid this popped up

stuck thicket
stuck thicket
#

WE ARE LIVE 10% off all items in stock code is unicode expires 5/29/19 @ 11:59pm ET #askanengineer https://youtu.be/EIHTz0hifjk & http://www.adafruit.com

Multistreaming with https://restream.io/ ----------------------------------------- LIVE CHAT IS HERE! http://adafru.it/discord Adafruit on Instagram: https:/...

β–Ά Play video
median summit
#

is there a way to send gps data from say an android to a RPI?

open dock
#

i would imagine its possible using WiFi or Bluetooth...

#

though, you may have to write the actual Android app if one isn't available...

tulip comet
#

or use a web app running on the pi that you connect to on an android browser

patent barn
#

You can actually get sim support for a rpi.

#

I was thinking of implementing something this way

blazing granite
#

Is it possible to power an arduino uno with a wall outlet? Using a step down transformer and a voltage regulator of couse.

vague crane
#

Via the DC jack or the input pin itself?

blazing granite
#

The Vin pin

robust portal
#

The Arduino uses DC and wall outlets give AC so you'd need a rectifier too but yeah it will work

plucky shard
#

@main tiger (a few days later) yes, you can make a SAMD51 build using part of the internal flash for CIRCUITPY. Examples that already do this are ports/atmel-samd/boards/sam32 (using a SAMD51J20A) and boards/kicksat-sprite (SAMD51G19A

tawny fiber
#

@open dock if I was to build some board using circuitpython myself which has to interact with two or three sensors at the same time (namely a bme280, some EEPROM and some LORA radio, maybe a RFM69 or something like that), what MCU would you recommend to me? (considering that I imagine such a program in circuitpython taking quite some Flash memory away, especially size wise)

open dock
#

the SAMD51s are the most capable right now. with an external SPI Flash, you should have plenty of RAM to load all of those libraries.

#

though, EEPROM will have to be a hand-rolled library. though you could also work in a C-side driver..

tawny fiber
#

Alright, Ill look into both of that then thanks πŸ‘

open dock
#

yw! i'll keep an eye out...i expect good things. πŸ˜„

tawny fiber
#

eh it depends on the guy I know who would do the actual hardware side

steel aurora
#

making a badge for an upcoming Python Meetup here in Oslo.

sturdy ridge
#

Now put it on a single PCB and use it as a Business card

steel aurora
#

now with sound effects

hybrid sage
lean valve
#

Looks like CircuitPython has also been featured in the 5/30 edition of Python Bytes, congrats again to those dudes

night dust
#

It looks like your main loop will hang until GPIO 18 is pressed

#

Then hang until GPIO 23 is pressed

#

You probably don't want to have those while True loops there

sturdy ridge
#

Or use .sleep commands

night dust
#

Sleep is fine

#

It's a hacky way of debouncing, though

#

Ohh, yeah, don't use sleep in the main thread.

#

derp

opaque lily
#

Sounds good, i'll update it when I get home

opaque lily
#

So now I have this code (revised) the game works fine and now I'm still trying to get some input from my GPIO pins (left and right movement)

night dust
#

@opaque lily rather than poll the GPIO, you should set up an event to detect falling/rising edges and set an internal variable accordingly

#

As a bonus, you could add some print statements to the event handlers to debug your buttons.

opaque lily
#

So you're saying i should use

#

GPIO.add_event_detect(23, GPIO.FALLING, callback=my_callback2, bouncetime=300)

#

and

#

def my_callback2(channel):
print "falling edge detected on 23"

#

?

night dust
#

Something like that. I'd implement it as a class:

class Button:
    def __init__(self, gpio_number):
        self.__gpio_num = gpio_number
        GPIO.setup(self.__gpio_num, GPIO.IN, pull_up_down=GPIO.PUD_UP)
        self.__gpio_state = GPIO.input(self.__gpio_num)
        self.__lock = Lock()
        GPIO.add_event_detect(self.__gpio_num, GPIO.FALLING, callback=self.__on_falling_edge, bouncetime=300)

    @property
    def is_activated(self):
        with self.__lock:
            return not self.__gpio_state

    def __on_rising_edge(self):
        print("The button was released")
        with self.__lock:
            self.__gpio_state = True

    def __on_falling_edge(self):
        print("the button was pressed")
        with self.__lock:
            self.__gpio_state = False
#

Then you could replace your GPIO.setup calls with button_1 = Button(18)

#

And in your polling function just check if button_1.is_activated

#

Note: that code isn't tested, so don't expect it to work right away πŸ˜›

sturdy ridge
#

When you're dealing with stuff that should be "polling" all the time which disturbs other ongoing computation the answer for higher levelish work is generally async or something similar and for lower level stuff, it's interrupts

#

Interrupts are very very important to know

opaque lily
#

Hm, so what would i have to do to implement this into my own code? (Where to put it and should I change anything in the above code

#

(sorry not too fluent in python) thanks for the quick replies and help!

#

i tried putting the gpio_number as 18, but then i realized that i have two buttons, would I have two classes?

sturdy ridge
#

Two buttons = 2 instances of the same class

#

button1 = Button(18)
button2 = Button(19) or whatever

opaque lily
#

okay.. but then how would I put it into the code that seepho had provided though?

#
button1 = Button(18)
button2 = Button (23)
class Button:
    def __init__(self, gpio_number):
        self.__gpio_num = gpio_number
        GPIO.setup(self.__gpio_num, GPIO.IN, pull_up_down=GPIO.PUD_UP)
        self.__gpio_state = GPIO.input(self.__gpio_num)
        self.__lock = Lock()
        GPIO.add_event_detect(self.__gpio_num, GPIO.FALLING, callback=self.__on_falling_edge, bouncetime=300)

    @property
    def is_activated(self):
        with self.__lock:
            return not self.__gpio_state

    def __on_rising_edge(self):
        print("The button was released")
        with self.__lock:
            self.__gpio_state = True

    def __on_falling_edge(self):
        print("the button was pressed")
        with self.__lock:
            self.__gpio_state = False
night dust
#

Put the class near the top of the file -- just after your import statements

opaque lily
#

alright, where would i define the buttons and would i keep my original code there as well?

night dust
#

Define the buttons just before your mainloop. Naturally, the mainloop will need to change to reference the newly defined buttons

opaque lily
opaque lily
#

also, how would i set it so that button 1 (pin 18) and button 2 (pin 23) can go left and right in this class? (23 being the left and 18 being the right

opaque lily
#

OKay, so I changed it back

#

this is my code, it's a pygame where i use gpio buttons 18 and 23 to go right/left

unkempt wedge
#

Hi all!

I'm writing a simple micropython script for my esp32.

It's a simple http server and it's working fine. I would to control some smartlighting with this.

But how can I recognize query strings to use with commands?


response = """<h1>Hello World!</h1>"""

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', 80))
s.listen(5)

while True:
  conn, addr = s.accept()
  print('Got a connection from %s' % str(addr))
  
  request = conn.recv(2048)
  request = str(request)
  print('Content = %s' % request)
  
  conn.send('HTTP/1.1 200 OK\n')
  conn.send('Content-Type: text/html\n')
  conn.send('Connection: close\n\n')
  conn.sendall(response)
  conn.close()```

I.E.:
    192.168.31.182/?led=on
    192.168.31.182/?led=off
stuck thicket
stuck thicket
#

10% off all items in stock code is EXCAMERA expires 6/5/19 @ 11:59pm ET #askanengineer https://youtu.be/D6ZJ8JeJiY4 & http://www.adafruit.com

Multistreaming with https://restream.io/ Visit the Adafruit shop online - http://www.adafruit.com ----------------------------------------- LIVE CHAT IS HERE...

β–Ά Play video
jade orchid
#

Hi @unkempt wedge, I think it would be much simpler to not handle the bare connection yourself. I suggest to use a framework for that. A quick search I found https://github.com/jczic/MicroWebSrv that is for micropython. You then can create function for any endpoints you like. In your case something like %ip%/led/on %ip%/led/off ( or a single one %ip%/led/<status>).

past epoch
hallow igloo
#

ty

past epoch
hallow igloo
#

any tutorials specifically for esp 8266 @past epoch

#

i only got a esp 8266, got nothing else lmao

past epoch
#

thats the Huzzah thing?

#

the small wifi board?

hallow igloo
#

huh

#

yeah

past epoch
#

that you have to use C to write, you need specific boards to write python.

#

when it comes to the 8266 i think you need the Feather variant

hallow igloo
#

oh, so i need to use arduino

tawny fiber
#

however its no longer supported so that might not be your best approach

past epoch
#

adafruit keeps their site up to date. if you want a board to write python, i recommend curcuit python express

#

Circuit Playground Express

#

this is the correct name

hallow igloo
#
serial.serialutil.SerialException: could not open port 'COM1': FileNotFoundError(2, 'The system cannot find the file specified.', None, 2)
serial.serialutil.SerialException: could not open port 'COM1': FileNotFoundError(2, 'The system cannot find the file specified.', None, 2)```
#

uh, help?

#

@past epoch any idea

tawny fiber
#

assuming your arduino / esp / whatever is connected, this might not be the correct port to communicate with it, try COM0 and if that doesnt work maybe open up the arduino IDE and check what it shows for available serial ports

hallow igloo
#

how do i do that?

tawny fiber
#

what part of that

hallow igloo
#

changing the port to com0

tawny fiber
#

well for that we would have to know what you are even doing

hallow igloo
#

i got my esp connected, and im trying to run a example on arduino

#

its the "blink" example

tawny fiber
#

yeah and how exactly are you trying to do that

#

what command are you running

hallow igloo
#

im compiling it?

#

upload *

tawny fiber
#

how exactly are you doing that

hallow igloo
#

by clicking the upload button

#

πŸ˜‚

tawny fiber
#

in the arduino IDE I assume?

hallow igloo
#

yea

tawny fiber
#

can you click on the tools button

#

and scroll down to an option which should be named port (i got mine in german so idk exactly)

hallow igloo
#

kk

tawny fiber
#

yeah go down to port

hallow igloo
#

done waiting for it to upload

#

ayy it worked

#

ty!

tawny fiber
#

πŸ‘

hallow igloo
#

anything interesting i can do with these?

#
SATA OPTICAL DRIVE CONNECTOR BOARD

1gb ram

Mini PCIe mPCIe Notebook Wifi Wlan Card

a fan```
tawny fiber
#

I mean you could build some wifi connected HD or something like that with lots of effort

hallow igloo
#

@tawny fiber do u know how to make a bitcoin mining rig

#

i wanna make one for fun, i got a spare cpu

tawny fiber
#

thats not profitable at all anymore

hallow igloo
#

ik but i wanna make it for fun

tawny fiber
#

and you need a whole computer or an ASIC for that

#

not just a cpu

hallow igloo
#

oh? :/

#

rip

tawny fiber
#

a cpu is just a piece of electronic which can do arithmetic operations, it doesnt have any storage and barely any memory itself

hallow igloo
#

yah

#

i got a cpu and

SATA OPTICAL DRIVE CONNECTOR BOARD

1gb ram

Mini PCIe mPCIe Notebook Wifi Wlan Card

a fan

tawny fiber
#

well i guess you could make something up with that if you had a whole motherboard

hallow igloo
#

its in the bin

#

lol

tawny fiber
#

and an actual HD

#

i mean in the end youll have to buld and actual computer

signal nova
#

is it possible to use raspberry pi for motor control(induction motor and vector control)?

tawny fiber
#

should definitely be possible yes

sturdy ridge
#

GΓ©nΓ©rally the proper way to control an induction motor is a variable frequency drive because there's a lot of work to be done in controlling induction motors wrt controlling high voltages and input frequencies

#

You'll have to figure out how to interface the VFD with the pi

#

I don't have too much experience with dealing with VFDs other than what I've done with my courses so I can't give much more insight than that

uncut flower
#

Well, control and power

blissful kayak
#

for power yes but you need relay

#

for control yes, I guess fan is just on/of? And are there any special lighting modes for light

uncut flower
#

Ahh, gotcha.
And no special modes. I'm thinking of maaaybe adding some speed settings depending on heat?

#

Also a humidity sensor so I can get reports on humidity inside the terrarium.

blissful kayak
#

ye this is plausible for arduino

#

it can do much more then that

uncut flower
#

The only thing I want for the lighting is a timer for it, along with sensor reports.

blissful kayak
#

yup arduino will have no problem with that

#

For good timer you may want to use some outside clock module, but I guess default is good too

uncut flower
#

I should compare prices too.
Would a pi-zero also work good?

blissful kayak
#

ah that would be kinda an overkill

#

you can get cheap arduino from ebay for like 2$

#

it's basically just a chip on board

#

arduino nano

uncut flower
#

Oooh, gotcha.
That sounds a lot better. I'm aiming for cheaper options.

#

That still work well, ofc.

blissful kayak
#

will take like a month to ship tho

uncut flower
#

But yeah.
That's no issue. I can buy and in the meantime I can build up the terrarium.

#

Since it hasn't been made yet

blissful kayak
#

just make sure you have data connector ready since it's using format you probably don't have layint at home and most of them doesn't ship with it

#

you can find bundle with cable for like <5$

uncut flower
#

Oh cool! I'll check it out, yeah.
Thanks a lot BD!

marble swan
#

Anyone got experience with Sim868 or any Sim8xx model?

main depot
#

Any one know if any good resources or tutorials for programming rgb strips using a rasp pi?

jade orchid
main depot
#

@jade orchid Thank you! I'll dig in to that.

surreal moat
#

How alike is Lego Mindstorm to the things you do here?

#

I have recently become interested in robotics and such

#

the little experience I have in it as of now is only Lego Mindstorm, which I personally got very bored of quickly

#

so I'm just wondering how big the difference is between Adafruit related things and Lego Mindstorm

stuck thicket
stuck thicket
#

10% off all items in stock code is GPSUSB expires 6/12/19 @ 11:59pm ET #askanengineer https://youtu.be/mlFJr_6fiO0 & http://www.adafruit.com

Multistreaming with https://restream.io/ Visit the Adafruit shop online - http://www.adafruit.com ----------------------------------------- LIVE CHAT IS HERE...

β–Ά Play video
eager agate
#

what microconntrols works with mpython?

open dock
#

@eager agate i don't keep up with partial/full support, but the supported boards that i know of are:

  • MicroPython's in-house boards: pyboard & pyboard D-series
  • ESP8266
  • ESP32
  • WiPy & CC3200
  • micro:bit
  • nrf52840
  • Teensy (don't know which version)
eager agate
#

how about a kid freindly python microcontroller?

languid hill
#

how young? if you just want an all in one device suitable to someone that can handle a few wires you could try the https://www.adafruit.com/product/3333
it has a bunch of sensors and other fun things built in, so they dont have to actually learn soldering/breadboarding etc yet.

open dock
#

for micropython + kid friendly, i'd say the micro:bit. https://microbit.org/
for circuitpython, i'd agree with riff; a Circuit Playground Express is the way to go.

#

both are supported by MakeCode (block programming) as well, so no *Python necessary.

eager agate
#

no, i want a 10 - 13 ('cause i am 10 = 13) years old python text (not block programming) microcontroller like arduino, but with python, and kid freidly

#

and also can i do stuff with the microbit like the arduino?

open dock
quartz remnant
#

Working on a project of mine, thinking of getting some stuff for my RPi, any recommendations for display and/or buttons, preferably as cheap as possible (text-only works for me, and buttons is a minimum of 5)

blissful kayak
#

I think 16*2 LCD displays would be the cheapest

quartz remnant
#

For now it looks like I'll go for an adafruit LCD keypad kit, though I might get external buttons from pimoroni

#

The only problem I have is that I don't have soldering as option, which would make it a bad choice

night dust
#

I strongly recommend the RPi-branded touch displays.

quartz remnant
#

So what I'm asking here is:
What are cheap parts for a Pi 2b, that

  • Don't require soldering
  • Are easy to install on it with no hardware knowledge
    A text display and 5 buttons is all I need
#

Yeah no I prefer hardware buttons and I dont even have $80

#

A 16*2 display seems good but I can't find one that doesn't require soldering or doesn't take long to install on it

night dust
#

I'd imagine you could find one with a header pre-soldered

quartz remnant
#

Do I just take it and put it on the pins or what

#

Again I have no hardware knowledge so this is all really confusing to me

night dust
#

Ahh, that would be a challenge, then.

#

The RPi touch display would work right out of the box; configuring this would require finding software to drive it.

quartz remnant
#

Hmm

#

I know the adafruit ones have python libraries

#

But I'm not sure if installation is as easy

night dust
#

All of these displays that I've seen use the common HD44780 controller, which has a python library: https://pypi.org/project/HD44780/

quartz remnant
#

https://kiwi-electronics.nl
This is where I'll be buying from, so if you can find anything, let me know

blissful kayak
#

so if you have wires you can connect it

quartz remnant
#

Oh wait I'm making some mistakes here

#

I keep confusing the version

#

It's just a B+

night dust
#

Any RPi should be fine as long as you have 6 GPIO available.

quartz remnant
#

Idk what GPIO is

night dust
quartz remnant
#

So I'm assuming if I get one of these boards I just have to put it into the pins it requires?

night dust
#

Pretty much. If you have a breadboard, male-to-female header wires, and one of those LCDs with the header pre-soldered you should be good to go once that Python library is configured.

quartz remnant
#

What's a breadboard and mtf header wires?

night dust
quartz remnant
#

This is gonna cost me even more isn't it

night dust
#

One thing worth noting: when you're mixing wires around like this you can easily make a mistake and fry some or all of your components. So be careful :3

quartz remnant
#

Oh god

night dust
#

Having said that, this is a great starter project for this kind of stuff

quartz remnant
#

I mean the software is difficult enough already

night dust
#

There are plenty of tutorials, and plenty of people here who can help.

quartz remnant
#

Especially since it needs to run real-time on a pi

blissful kayak
#

if you're strictly on budget you can get that stuff very cheaply on ebay, but you'll have to wait like 1 month

quartz remnant
#

Ouch

#

I was hoping to have the interface done by the end of this week ^^"

#

Looks like I'll have to wait a month either way; to get paid or to get it from eBay

blissful kayak
#

to get paid?

quartz remnant
#

Yup, gonna hear if I got the job tomorrow and if I did I can start next Monday, and get paid at the end of the month

sturdy ridge
#

Good luck!

quartz remnant
#

So one issue I'm seeing here is that breadboards seem pretty large whereas I'd hoped to keep it as small as possible... any ideas?

steady juniper
#

You can solder stuff to blank boards instead, (dunno the proper english term)

#

should be available from every electronics/DIY shop

quartz remnant
#

again, unable to solder

steady juniper
#

oh, didn't see that

#

but yeah, a small breadboard is probably as compact as you can get without soldering

#

they come in all possible sizes

night dust
#

You can get smaller breadboards

quartz remnant
#

is it possible to get one that fits on top of the rpi?

#

I'd rather keep it as small as it is right now

night dust
#

What kind of mechanical assembly are you picturing? Realistically, you don't need a breadboard.

quartz remnant
#

I just want to add a small display and preferably some button inputs to my rpi

night dust
#

If you have female-to-female jumper wires you can connect directly from your RPi header to your LCD's header

quartz remnant
#

jumper wires?

#

god im googling so much today

night dust
#

Good πŸ˜„

quartz remnant
#

oof, $3 for the cheapest ones

#

I wish there was something like pcpartpicker for this that showed what you need and maybe how it'd fit together

#

Because I'm really having some trouble visualizing how it would look with what parts

#

actually

#

that's a touch LCD

#

I just don't know how to deal with taking full control of a SPI device

#

Would this be worth it, compared to the other ones? I don't know how SPI works and it doesn't seem very well documented on spidev, so that's the only con I see right now

quartz remnant
#

so from what I've heard, Adafruit's ILI9488-compatible code should work for writing to the display, but I can't seem to find any details about the touchscreen, any ideas?

marble swan
#

iirc the pi will take control of the display and be pretty much what you call Plug and Play

#

especially with raspbian anyway

#

i am sure thats how it went for me when i attached a screen to the header

quartz remnant
#

got it

#

so then the only issue left is finding a cheap DAC because the builtin one is garbage

#

but I can't find one that goes somewhere other than where the screen already goes

#

and about the display I just want to make sure I can use it as a non-display screen since I want it to be under full control from python

lunar owl
#

What kind of microcontroller should I start with?

tawny fiber
#

(copying sommersoft's answer here)

  • MicroPython's in-house boards: pyboard & pyboard D-series
  • ESP8266
  • ESP32
  • WiPy & CC3200
  • micro:bit
  • nrf52840
  • Teensy (don't know which version)

with the microbit according to him being one of the most kid friendly / easiest ones

lunar owl
#

What about pi?

tawny fiber
#

the pi isnt a micrcontroller

#

its a Cortex-A chip so its meant to run actual operating systems

#

however you can still do a lot of things with the Pi which you can do with a MCU

dense copper
#

I am new to this space. What is circuit python? Different from MuPython?

opal mason
#

CircuitPython is derivative of MircoPython with some changes that should make it easier to learn and use

#

It was developed by AdaFruit for AdaFruit boards, like the Circuit Playground Express

dense copper
#

Hm. Since we are talking of micro controllers ( and I am oldish), does it actually complie to assembly code or does the new crop of microcontrollers actually work on interpreters?

tawny fiber
#

the intrepreter of python is still a compiled c program which executes python code or bytecode

#

I dont know of any MCU CPU etc which actually just runs an interpeter

dense copper
#

Thanks Ves and Nix

lean valve
#

That Being Said,

#

You can still program all these microcontrollers in the old school way. For example even the shiniest Adafruit toy, the Circuit Playground Express, can be used as an Arduino. CircuitPython is optional.

hallow igloo
#

What voltage should i provide at a Wemos D1 R2 in the Vin pin? Is it 5 or 3.3 volts?

sturdy ridge
hallow igloo
#

then how about the 5V output voltage?

sturdy ridge
#

I don't think it's a 5V output voltage as much as it is 5V input with a voltage regulator

eager agate
#

what's better than micro:bit?

tawny fiber
#

Define "better" in this context @eager agate

eager agate
#

google it if you dont know

#

wait i did a typo

tawny fiber
#

I do know the meaning of better

#

But what do you think is better

#

Easier to program

#

Faster

#

More peripherals

#

More memory

#

Less power consumption

#

Etx

#

So what exactly do you mean with better, there are dozens of things which can make an MCU better or worse and a lot of them depend on your use case / point of view

#

So the question is what do you want in your alternative microcontroller that the microbit does not have

#

Sooo?

eager agate
#

@tawny fiber the micro:bit is easier to use

tawny fiber
#

than what

#

And you again didnt say what you want in your MCU that is "better" than the microbit that it doesn't have yet

#

Question mark

eager agate
#

idk anything you said im just a kid that likes my micro:bit

#

just shut it

#

anyway what do you think is the best and can you give a list pls

tawny fiber
#

If I have your definition of best or your use case yes I presumably easily come up with a list, as you're not giving me enough information however I can't answer your question

eager agate
#

in your opinion not mine

#

you choose

#

anything

#

what's your definition of bese?

#

best*

tawny fiber
#

Well in my opinion there is a best MCU or at least a group of MCUs for every usecase, for example an Arduino will hardly be useable to build a digital camera because of its small memory, you'd be better if with a raspberry pi or a higher class MCU like for example a more modern STM one

lean valve
#

you could join the code jam and perhaps win a pyportal, those use python and have touchscreens...

eager agate
#

excuse me can i add a link?

#

i dont know if it's a raspberry pi or not

lean valve
#

If it's about microcontrollers/python then for sure!

eager agate
#

is this a arduino?

lean valve
#

No - not arduino compatible

#

Raspberry Pis are full computers on a small board

eager agate
#

oh

#

i really wanna go to the camp

#

is it a microcontroller tho?

lean valve
#

We include it in microcontrollers here, it's kind of on the edge of being something bigger

#

Also I really hate to have to ask this but aren't you too old for this camp?

eager agate
#

no i use my father discord to talk

#

so i can get help so no

lean valve
#

I'm really sorry but we have to boot you out

#

We follow the Discord rules and those say you have to be 13 just to use it.

eager agate
#

my father

#

tho

#

he ususes this and does not know i do

#

ik his pass lol

#

he teached me python

lean valve
#

That's good, and I hope he continues, but you can't be on Discord by yourself, sorry

eager agate
#

oh ok

#

bye

lean valve
#

!tempban 568142562678800385 3y Underage user

hasty zealotBOT
#

:incoming_envelope: :ok_hand: banned @eager agate until Wed, 15 Jun 2022 00:49:21 GMT (Underage user).

marble swan
#

Is it possible to interface with any device?

#

I have a pcb looks like some controller is on it

#

But how do i interface with it? is it a case of soldering a serial device to it?

tawny fiber
#

that highly depends on the device

#

there are a million protocls

#

can you maybe show us a close up picture of your particular device? often manufacturers write down what is tis there @marble swan

marble swan
#

yes sure

#

oops

tawny fiber
#

is that a walkie talkie?

marble swan
#

naw a camera

radiant sparrow
#

@marble swan Are you Scottish?

marble swan
#

lol no

radiant sparrow
#

I don't see many people say "naw"

#

unless they're from Scotland

#

Β―_(ツ)_/Β―

marble swan
#

i speak many forms of "broken english"

radiant sparrow
#

ah

#

well, Scots is it's own language actually

marble swan
#

So i was wondering

radiant sparrow
#

just thought i should throw that in

marble swan
#

They must of programmed that device to do what it does

#

I am new to this world

tawny fiber
#

I mean it is unlikely but there are certain ways to circumvent the need of programming a device

marble swan
#

But is it a chip that was programmed first then put on?

tawny fiber
#

so its definitely not a must have

#

anyways

#

im trying to figure out what CH in this context might stand for

#

it might be the company

#

whats the name/model of the camera?

marble swan
#

Well i found this on the board

#

one sec

tawny fiber
#

looks like there is a wifi camera called md81

marble swan
#

Yeah has a wifi controller too

#

There is something referencing TX there

#

which if i am right there should be a RX too

#

transmit and receive

tawny fiber
#

that might also just be a test point for anything on the chip

#

can you maybe swap it over and show us the back too?

marble swan
#

the back contains the wifi controller and an sd card reader

tawny fiber
#

I mean chances are high this is chinese MCU xxxxxxx and we'll never identify it but we can try

#

are there any other tes points?

marble swan
#

looking

#

I bought a cheap microscope

#

having problems with it πŸ˜„

tawny fiber
#

two things

a) can you maybe try to rub this blue shade on the main controller away, maybe there is more intel hidden under it

b) if you happen to have an Arduino or whatever wire its rx up to the TX and check the serial monitor for some output

marble swan
tawny fiber
#

thats the flash memory

#

aka where the program is stored

#

or at least there is a chip from bright moon semiconductor which is an SPI flash memory., has this name and the fitting pin amount

tawny fiber
#

thats just usb soldering points we very likely dont really care about

#

can you try one (or even both of the things) i listed above?

marble swan
#

I was just wondering if they disabled the usb ability to interface via HID or something(sorry don't know the terminology)

#

I have a soldering kit coming tomorrow

#

I will try to work out how to get the tx to the gpio of the raspberry pi

tawny fiber
#

just connect a wire to it

#

like literally put one end of the wire to the rx of the RPI, the other at the tip of the TX test pad and check if you receive something

marble swan
#

would minicom work for that?

#

something to read it

tawny fiber
#

yeah minicom should be just fine

#

just pick some baud rate like 9600 and if you see anything youre good (if its weird shit change the baudrate to other commonr ates)

marble swan
#

guess all this is power related

tawny fiber
#

yeah

#

just do the minicom thing

#

and after that we're gonna dump the SPI flash to see what its got

marble swan
#

i am a bit wet behind the ears with electronics

#

Will i also need to put to the GND as well as RX?

#

Don't want to fry the poor pi

tawny fiber
#

highly unlikely you will

#

and no you wont, just the TX to the Pis RX should be fine

marble swan
#

Ok when setting minicom

#

where do i tell it to look because i have only 2 uart

tawny fiber
#

2 uarts?

marble swan
#

ttyS0 and ttyAMA0 the latter is bluetooth

tawny fiber
#

do the SO one

marble swan
#

Yeah i thought that might be the one

#

thx

#

last question πŸ˜„

#

Do i have to be specific with the gauge of wire?

#

Because i have some old USB cables

tawny fiber
#

highly unlikely

#

usb cables?

#

how are you gonna wire a USB cable to a testing pin

marble swan
#

yeah i was thinking i could cut the wire

#

use the wire

tawny fiber
#

no

#

a usb cable consists of 4 internal wires

marble swan
#

i mean cut a wire from it?

tawny fiber
marble swan
#

a single wire

#

because i don't have an wire laying around i don't think

tawny fiber
#

get one then

#

we're gonna need 4 wires for the SPI flash :p

marble swan
#

ah

#

Can i use that wire that people use on breadboards?

tawny fiber
#

yes

#

thats the one abvoe

marble swan
#

Ok i'l have a look where i can get it

#

I am super interested in this

#

The thing doesn't function properly

#

But i imagine its software related

#

Because its supposed to be able to search for wireless ap

tawny fiber
#

i mean i doubtw e can fix this

marble swan
#

Ah im not really bothered about that it was only $8

#

Just interested in what its actually doing

#

It puts out its own wireless AP to connect to though

#

and then you can view the cam from that

#

But its a bit gimmicky since its not password protected

#

So anyone can connect

#

cheap Chinese junk

tawny fiber
#

yup

#

so get the wire and see what we can read from the TX pin

#

and if that doesnt give us enough intel yet we're gonna tackle the SPI flash

marble swan
#

What data are we even looking for?

tawny fiber
#

we still didnt identify the chip

#

so maybe it dumps some intel about itself on the tx pin

#

or whatever

marble swan
#

Ok i'll have to figure out how to get minicom to dump to a file

tawny fiber
#

nah just read form a console

#

just look at what its reading

marble swan
#

Yeah ok

#

It looks like some of the chips have been scrubbed out of info by a marker pen or something

#

interesting

#

Maybe i'll ty some alcohol on them to remove it

tawny fiber
#

yeah i already mentioned that around half an hour ago :p

marble swan
#

oh yeah sorry

tawny fiber
#

dont worry

tawny fiber
#

found anything under the marker pen? @marble swan

marble swan
#

Not yet family stuff in the way πŸ˜„

tawny fiber
#

k, just hmu once you got something then ^^

marble swan
#

@tawny fiber

tawny fiber
#

so there was nothing under it

#

😦

marble swan
#

oops wrong chip

#

but yeah think there is nothing

tawny fiber
#

right

#

onwards to checking the tx pin then

marble swan
#

iirc ^ that is the chip with the blue mark

tawny fiber
#

nah it was the bigger MCU

#

this one

marble swan
#

ah

tawny fiber
#

anyways, you wont get around checking the SPI flash and the tx pinow

marble swan
#

yup

#

will have to wait for the kit i ordered

tawny fiber
#

Can someone tell me what a so called "series 25" SPI EEPROM is? Ive stumbled upon this term in a library but cant seem to find anything on google

sturdy ridge
#

From the sounds of it, external EEPROM that you talk to through SPI. Series 25 is probably specific to the manufacturer/brand used

marble swan
#

@tawny fiber You say just a single wire?

#

To RX of pi and TX of device

tawny fiber
#

yes, should be fine

marble swan
#

ok testing now

#

nope nothing

#

thats an anti climax

tawny fiber
#

WELP

#

onwards to the spi then

marble swan
#

I was really hoping that would reveal something

#

Like the secrets to life etc

#

πŸ˜„

tawny fiber
#

right

#

so

#

at this point I dont really see much more than dumping the content of this SPI Flash from the other day

marble swan
#

Ok when you got time please explain how i will do that

#

I think the pi has the ability for SPI

tawny fiber
#

it does

marble swan
#

Oh boy so i have to desolder the chip

tawny fiber
#

I mean you could also attach the 6 wires we need

marble swan
#

interesting

tawny fiber
#

either way we'll need the voltage + GND and the 4 connections for SPI

marble swan
#

I did look at the data sheet for the flash chip

#

details the pin out

#

Must i solder the wires to the chip?

tawny fiber
#

you have to connect them

marble swan
#

Yeah silly question i guess πŸ˜„

#

I have a strip of wires like you pictured the other day

#

Does color coding matter?

#

I guess it doesn't

#

This sounds complex indeed

#

I think i read the chip has speed of 414mb

#

Or is that Mhz

#

idk am very new to this

tawny fiber
#

it doesnt matter yeah

#

and with a bit of luck its supported by some linux tool builtin

#

if its not we're gonna have a heard time reading from it

marble swan
#

EΓ‰3@Γ€<PΓ·`PΒ€<@Β ΓΌΓΏΓ AIΒ’ @Β’I € HA AΒ€AΒ’AΒ’Β’  @($@ $@Β’H A Β’ HΒ€ @Β’A$  Β’Β’Β’$7sdram_init 1172a7--9c4 4 CAS:1--RFC:9--RP:2--RCD:2--DISIZE:0--AREFEN:1--SDCKHD:1--SDCKOE:1--SDRAMSIZE:3 SDRCON0:d72a7--2M init Β€!?ΓΈ?þÂÀΒ€ Β€ Β€@Β€ Β€@Β€ @Β€   €€ Β€€€Β€Β€ Β€ Β€Β€ Β€€€  Β€   Β€!Β€

#

I tried again and got this

#

I believe that is 115200 buad

#

Tried 9600 too

tawny fiber
#

Ohhh

#

Now that's interesting

tawny fiber
#

@marble swan any idea why there are so many corrupted characters

marble swan
#

Well..

#

I believe that data didn't come from the TX on the board

#

So i must of touched some of the other pins near by on the chips

#

OR that is the raspberry pi itself

#

Because i tried again carefully on the TX pin and got nothing

#

Need much practise

#

I must have the + - mixed as there is interference

#

Or having bare wire is causing it idk

ancient harness
#

Oh

#

Hmmmm. Maybe it could be a (de)coupling problem or you need to have GND hooked up. I'm unsure.

marble swan
#

I just need to clean the solder I tried to reflow it and not use new solder.

#

I’ll get some flux and a copper wire that should work to clean it

stuck thicket
#

please fill this out, it's for more python on hardware, this time, from VS code. no personal info is needed to fill out...

"Hello there, we're a group of interns at Microsoft Vancouver, working in The Garage! We're looking for insights into your experience around physical computing projects. As well as your interest in trying out a new method of development for your project - say goodbye to waiting for your code to build and compile inside Arduino IDE with C/C++, Python is here to help! This survey will only take 3 - 5 minutes and your insights are very valuable to us!"

https://twitter.com/nnja/status/1140807884474732544
https://forms.office.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbRx50AHoXr3BImxtzTGKK4edUMEJNUUFTUUdGRFhOVUg0N0RBN0paOFJBRy4u

πŸ‘‹ Interested in Python or programming microcontrollers with Python 🐍?

If you can spare a few minutes, the interns at @MSFTGarage in Vancouver need your input for a user testing a ✨new✨ @adafruit #PythonHardware VS @code plugin.

Fill out the survey πŸ‘‡https://t...

sturdy ridge
#

I didn't even know the Vancouver office had interns

stuck thicket
#

turtle on: pygamer, pybadge, pyportal, and not-out-yet-smaller-version-of-pyportal

vague crane
#

Whoa, cool!

#

I hope that’s the official branding for the new pyportal

#

Totally ready to preorder my NOYSVOPyPortal 😁

stuck thicket
#

πŸ˜ƒ

chilly tusk
#

I can't get my PyPortal to connect to my Windows 10

#

Anyone had the same issue?

#

It boots up properly and tells me to edit the secrets.py-file

#

but none of my USB's detects anything

#

I guess I need to download some driver?

#

Yeaaah.. Nothing happens nowhere

#

@stuck thicket , have you had this before?

#

"Press the reset button twice" don't work :(

chilly tusk
#

A lot of people end up using charge-only USB cables and it is very frustrating

#

That was it

chilly tusk
#

do people really use mu-editor? it looks so ugly

steel aurora
#

it's for beginners, mostly.

#

it does have really neat integration for microcontroller boards, but @silver surge recently wrote a plugin for atom that does the same thing so you can use that if you prefer

silver surge
#

please let me know of any install issues actually, some people are having issues with that

steel aurora
#

I know some members of this community were talking about doing the same for VSCode, Sublime Text and PyCharm too, but nothing that works yet. @chilly tusk

#

I'm sure we'll see it eventually, though.

chilly tusk
#

I mean I’ve never done anything with physical hardware before. I couldn’t get it working (red LED and not running the code.py file) I assume I need some dependencies or something, but it seems kinda hard to find information on how to just get started hehe

#

I’ll check your Atom plugin! Not that I really know what the integration is supposed to do, though πŸ˜…

#

Seems like red flash is not connected to WiFi, maybe it don’t like my 5G

steel aurora
#

you'll wanna clean it and then flash it with the latest software.

#

kattni has a great howto though

#

that should get you running.

stuck thicket
#

@steel aurora looks like @chilly tusk was helped on our server (cable issue)

#

@chilly tusk mu is not "ugly" that's not nice 😦

tawny fiber
#

looks better than IDLE

steel aurora
#

@stuck thicket excellent. glad he found some help. :)

stuck thicket
stuck thicket
chilly tusk
#

Thanks guys, I fell asleep yesterday.

#

I’ll look more into it on Saturday ☺️

#

Is it possible to buy humid sensors to the PyPortal? How modular is it?

steel aurora
#

sure you can.

#

some sort of humidy sensor breakout board could be wired to the I2C. there are probably other ways to do it, too.

#

you could chain a whole bunch of sensors onto that, if you wanted.

#

it does exactly that

open dock
#

@tawny fiber moving here. ot is crowded.. πŸ˜„

tawny fiber
#

yeah defintiely

#

^^

open dock
#

what is on the other end of the UART? PC?

tawny fiber
#

a pi

#

im just wiring up my pi rx tx to the rx tx pins i found in the code for my chip in the micropython repo

marble swan
#

I’m looking for a clip that will work with the pi

#

I assume most will

#

But some I’ve seen have all the crazy legacy ribbons

#

@tawny fiber i think you might know for reading flash rom

tawny fiber
#

i have no idea what a clip even is

marble swan
#

This

tawny fiber
#

no idea really

#

im actually here for some help instead this time ^^

marble swan
#

OK πŸ‘Œ

waxen zenith
#

Need help to write arduino or raspberry pi code to control 8 relays snd 2 pwd signals. Can pay for help.

tawny fiber
#

people here dont write code for you for money, we'll help you with a specific problem if you have one or provide resources though

open dock
#

@tawny fiber the micropython repo gets so foreign when i read it; we differ at some major points. πŸ˜„
another q though: could it be the UART settings? bits, parity, stop bit?

tawny fiber
#

I actually digged a bit into that and found the line of code where it sets them and i dont see an issue

open dock
#

assume you're using pyserial on the pi?

#

or just straight with screen, picocom, etc?

tawny fiber
#

the second one

open dock
#

ok. i would try playing around with the bits setting first. i think the REPL thing was a red herring that my brain took off on...

tawny fiber
#

you mean the baud rate?

open dock
#

no. bits = 7,8,9 baud could be a factor too, though.

#

which ADC is it?

tawny fiber
#

i didnt even get so far to write any software for it

#

id test on the three builtin ones of my chip

open dock
tawny fiber
#

but that could also be an attachment to a normal repl couldnt it?

open dock
#

yeah. normal repl is default. raw repl is entered by sending ctrl-A

tawny fiber
#

right

#

now i gotta wire everything up again as i had already given up on this and planned to continue with normal debugging

open dock
tawny fiber
#

yeah thats the second thing i was wonderin

#

how does one even execute python with micropython

#

like when I flash it my chip still comes up like normal on USB when i attach it to the STLINK interface

#

i cant put my script anywhere

open dock
#

it will look for main.py in the root folder, and run it automatically. boot.py, as mentioned in that forum thread, will run during...well, boot, before some things are setup.

tawny fiber
#

yeah im aware but i dont see a root folder ot put things in

open dock
#

oh. you don't get a mounted drive? /media/Nix/MICROPY (or whatever standard FAT label micropython uses..)

tawny fiber
#

Nah....I mean that might be the case becuase im just flashing it manually over openocd as nothing else is working but idk, never used this

open dock
#

there should be one mounted. it may need to be manually mounted. 🀷 other than that, its all REPL.

#

ampy used to be maintained by adafruit, but i think someone else took it over. you can transfer files without USB drive with it.
yep, taken over by pycampers: https://github.com/pycampers/ampy

tawny fiber
#

like I literally cant deploy this any builtin way for the openocd deploy I get

Warn : UNEXPECTED idcode: 0x6ba02477
Error: expected 1 of 1: 0x2ba01477

so i suspect im using a version its not thinking of

for st-flash I get an unknown flash type as it doesnt support the h7 yet iirc and this dfu thing i dont even know how to set up

#

do the deploy scripts do something a simple openocd "load" command wouldnt do?

open dock
#

i've never dealt with STs. does ST-Link/Flash work with GDB? that's how we do it, though primarily with J-Link...

tawny fiber
#

st-link works with gdb via openocd yeah

#

so ill just do my usual openocd procedure then....

open dock
#

ahh. ok.

#

i was Win10 only when i first got into circuitpython; openocd was a nogo, so i used Atmel Studio for the longest.

tawny fiber
#

i mean I can see that I flashed the firmware, i can debug it with my gdb after all buuuuut i dont see any file system what so ever coming up

open dock
#

does dmesg show the MSC getting established?

tawny fiber
#

so what I do get in my dmesg output is (HAH i was just fetching it ^^)

[136536.102470] usb 1-6: USB disconnect, device number 18
[136538.384166] usb 1-6: new full-speed USB device number 19 using xhci_hcd
[136538.512108] usb 1-6: New USB device found, idVendor=0483, idProduct=374b, bcdDevice= 1.00
[136538.512114] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[136538.512117] usb 1-6: Product: STM32 STLink
[136538.512120] usb 1-6: Manufacturer: STMicroelectronics
[136538.512122] usb 1-6: SerialNumber: 066FFF545257717867114125
[136538.571612] usb-storage 1-6:1.1: USB Mass Storage device detected
[136538.571991] scsi host0: usb-storage 1-6:1.1
[136538.572595] cdc_acm 1-6:1.2: ttyACM0: USB ACM device
[136539.631711] scsi 0:0:0:0: Direct-Access     MBED     microcontroller  1.0  PQ: 0 ANSI: 2
[136539.632433] sd 0:0:0:0: Attached scsi generic sg0 type 0
[136539.632787] sd 0:0:0:0: [sda] 4168 512-byte logical blocks: (2.13 MB/2.04 MiB)
[136539.632960] sd 0:0:0:0: [sda] Write Protect is off
[136539.632963] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
[136539.633119] sd 0:0:0:0: [sda] No Caching mode page found
[136539.633121] sd 0:0:0:0: [sda] Assuming drive cache: write through
[136539.646950] sd 0:0:0:0: [sda] Attached SCSI removable disk

but the SCSI is this weird disck by stm themselves which contains a readme + manual

open dock
#

hmm. wrong bootloader?

tawny fiber
#

uuuuh dont tell me you need a bootloader for this

tawny fiber
#

i hate this

#

just wanted to say that

open dock
#

now..i can't speak to need vs optional

tawny fiber
#

i mean it does say "STM32F4xx and STM32F7xx" but it also says that in the other readme as they got no real support for the in specfic h7 atm they say it "should be sconsiderd a faster F7 one for now"

#

i mean first things first i would be interested in which usb interface theyer even talking about

open dock
#
Re: Understanding the difference between bootloaders mboot and hw dfu
Post  by dhylands Β» Thu Dec 20, 2018 2:57 pm

The factory bootloader has limitations, like it only works on FS USB and not HS USB.

You might also want to bootload over alternate interfaces depending on your HW architecture.

The built-in bootloader only supports writing to internal flash. Mboot supports writing to an external flash chip as well.
#

so maybe not needed. debugging...so much funs! πŸ˜„

tawny fiber
#

like i got the one to the ST-LINK and the power USB plug....and I assume that the one for the ST-Link is for the st-link only?

open dock
#

faster = 3.0SS vs 2.0HS? and yeah, i would assume its the user-facing USB, not the st-link one.

tawny fiber
#

however when I plug it in there it doesnt get pwer and nothing lights up

#

conclusoin find a second fitting usb cable

#

if i plug something into the user facing one the kernel doestn even recognize it according to dmesg

#

😐

open dock
#

dev kits are wonky like this. on the nRF dev kits, we had to flash our bootloader to disable the on-board j-link, and allow our USB CDC to take over...

tawny fiber
#

but I want to get back to using Rust at some point too πŸ˜› im just doing this to check wether my Rust code or my chip are weird

open dock
#

these situations always seem like an easy "yeah, i'll verify with this". 6 weeks later...

tawny fiber
#

yeah i know!

#

this time its not even like a logic analyzer or whatever could help me because im working on something inside the chip

#

nix now: "embedded dev sucks"
nix when he fixed the problem an hour to 4 weeks like: "my brain fucking sucks"

tawny fiber
#

@open dock fixed my issue now, my peripheral clock for the ADC was too fast so the last three bits never got sampled 😐

open dock
#

always the clocks...bet never the first thing to think of. πŸ˜„

#

gladded you got it worked out though! πŸŽ‰

left gyro
#

Nix, what kind of MCU are you using '? πŸ˜ƒ

open dock
#

STM32H7, if i was reading correctly.

tawny fiber
#

@left gyro its an stm32h743zi (t6 revision y if youre *really interested :p)

left gyro
#

Thanks Nix. I googled. πŸ˜ƒ Interesting device πŸ˜ƒ

#

My work is based around an Atmel Chip based single board

#

Have much to learn about MCU's and Single Board devices. Learning little by little though.

#

(and it runs windows CE, due to certification standards and stuff)

tawny fiber
#

atmel chips can run windows?

left gyro
#

Sure πŸ˜ƒ

#

with Microsoft now also making the Linux Subsystem available, the lines are also starting to blur heavily, if you have the spare memory that is.

#

Probably more single board computer, than MCU though

tawny fiber
#

what atmel chip are we tlaking about there?

left gyro
#

AT91sam9g20

open dock
#

i was going to guess a CortexA based chip... i've haven't even come across an ARM926. interesting.

tawny fiber
#

arm9 is heavily outdated isnt it?

left gyro
#

windows ce6

tawny fiber
#

no I mean the chip family itself

left gyro
#

Not as far as I know. This is a new product line

tawny fiber
#

Since ARM9 cores were released from 1998 to 2006, they are no longer recommended for new IC designs, instead ARM Cortex-A, ARM Cortex-M , ARM Cortex-R cores are preferred.

left gyro
#

Certification on these device, take months if not years sometimes

tawny fiber
#

cough

left gyro
#

They still make and sell them.

#

I should clarify. With devices, I mean our entire board. I work for an "OEM" for lack of a better description.

tawny fiber
#

I see

#

but still, looking at the datsheet its from around 2001-2003. you should at least consider moving on to cortex-a ones in the future

left gyro
#

Next gen sure. That will likely be in 10 years.

#

These are our "New" product line. πŸ˜ƒ

tawny fiber
#

From when is your thing originally?

left gyro
#

Access control and security.

tawny fiber
#

No I mean year whise

left gyro
#

oh. This has been in development for 4 years i think

#

Im not a designer though. Just a firmware tester.

tawny fiber
#

Hm maybe arm didn't have windows capable cortex a's at that time

#

Not been long enough into programming to judge this :p

left gyro
#

When it comes to Banking and Military systems. Stuff moves SUPER SLOW

#

Usually because of Insurance company demands.

#

Getting stuff certified, takes forever and costs HUGE amounts 😦

#

Its not consumer electronics sadly.

tawny fiber
#

the job I'm getting in it security by the end of the year keeps getting more and more unattractive

open dock
#

not to mention...$10 non-wholesale per chip vs $51 non-wholesale per chip...

left gyro
#

Yup. a few cents even can make or break the uptake of a new system.

open dock
#

comparing against a cortex-A53

left gyro
#

The scale of manufacture makes its a big pain if you add even a few cents per board.

open dock
#

though, they are in totally different leagues.

left gyro
#

I wish I had a nice beefy chip to work with hehehe

#

Sadly, it is, what it is πŸ˜ƒ

tawny fiber
#

I got an email from the STM news letter (I unsubscribed 4 times from by now) today saying that they now have a 2 core h7....how does that even work, it's a MCU after all

left gyro
#

That sounds more SOC that MCU

#

I stand to be corrected though πŸ˜ƒ

#

I moved from Software to firmware testing this year.

#

Different beast totally.

tawny fiber
#

What's the difference?

left gyro
#

he distinction between an MCU and an SoC is much less clear, and the two terms are often used interchangeably. However, in common usage, the term SoC typically refers to MCUs with a greater number of onboard peripherals and functionality.

#

To copy and paste from Google πŸ˜ƒ

#

SOC. System on chip usually has video and audio and heavens knows what else. MCU is more basic IO.

tawny fiber
#

No no regarding your testing job

left gyro
#

oh!

#

lol

tawny fiber
#

I know what those are

left gyro
#

face palms

tawny fiber
#

:P

left gyro
#

Firmware involves the whole system, including testing the "OS" and whatever else is running on the device. with the software is normaly, more "user software"