Hi Friends!
Briefly: considering ways of uploading code to microcontroller
(particularly some Atmel's AtMega - same as used for Arduino) from the smartphone.
In details:
Programming MCUs (e.g. uploading firmware into their ROM) usually
happens via some proprietary interface (using SPI in case of AVR), or
UART, or JTAG. This generally involves dedicated software on the side of computer and some hardware (USB to UART or dedicated "serial
programmer").
Suppose we want to be able to write simple code using mobile phone - situation I met with my class of 15+ students with no dedicated lab
having 15+ computers.
I tried creating a small system containing two parts: First - html
web-page with a textarea to write assembly code, built-in AVRA assembly compiler (just compiled to javascript) - and some JS code which can
"beep" the bits of the hex-file containing firmware (via audio). Second
- bootloader for target MCU which uses ADC pin to "listen" to those
beeps via direct wire connected to 3.5 mm audio jack plugged into
smartphone - and "burn" incoming data into flash memory.
This works (if you are curious to try, it could be found in my github
page by same username) - however there is a sudden issue: almost half of students use mobile phones without 3.5mm jack - as nowadays it is the
era of wireless headphones already, I missed the fact!
So now I'm looking for further, alternative approaches. For example:
- attaching microphone to ADC pin instead of wired connector; code
should be beeped out via built-in speaker of the smartphone (it would be
a bit noisy class, of course) - I actually tried, but was not yet able
to come up with signal recognition algorithm of good enough quality.
- blinking data with display and catching it with photo-transistor
attached to ADC or digital pin, haven't tried for it seems like bitrate
would be very low (even though we generally need to upload firmware of
few dozens bytes).
Thus I'm open to any ideas / hints / articles on improving either of
these two approaches - or perhaps something completely different which I
may have missed.
Suppose we want to be able to write simple code using mobile phone - situation
I met with my class of 15+ students with no dedicated lab having 15+ computers.
I tried creating a small system containing two parts: First - html web-page with a textarea to write assembly code, built-in AVRA assembly compiler (just compiled to javascript) - and some JS code which can "beep" the bits of the hex-file containing firmware (via audio). Second - bootloader for target MCU which uses ADC pin to "listen" to those beeps via direct wire connected to 3.5
mm audio jack plugged into smartphone - and "burn" incoming data into flash memory.
This works (if you are curious to try, it could be found in my github page by same username) - however there is a sudden issue: almost half of students use mobile phones without 3.5mm jack - as nowadays it is the era of wireless headphones already, I missed the fact!
So now I'm looking for further, alternative approaches. For example:
- attaching microphone to ADC pin instead of wired connector; code should be beeped out via built-in speaker of the smartphone (it would be a bit noisy class, of course) - I actually tried, but was not yet able to come up with signal recognition algorithm of good enough quality.
- blinking data with display and catching it with photo-transistor attached to
ADC or digital pin, haven't tried for it seems like bitrate would be very low (even though we generally need to upload firmware of few dozens bytes).
Thus I'm open to any ideas / hints / articles on improving either of these two
approaches - or perhaps something completely different which I may have missed.
Hi Friends!
Briefly: considering ways of uploading code to microcontroller (particularly some Atmel's AtMega - same as used for Arduino) from the smartphone.
In details:
Programming MCUs (e.g. uploading firmware into their ROM) usually happens via some proprietary interface (using SPI in case of AVR), or UART, or
JTAG. This generally involves dedicated software on the side of
computer and some hardware (USB to UART or dedicated "serial
programmer").
Suppose we want to be able to write simple code using mobile phone - situation I met with my class of 15+ students with no dedicated lab
having 15+ computers.
I tried creating a small system containing two parts: First - html
web-page with a textarea to write assembly code, built-in AVRA
assembly compiler (just compiled to javascript) - and some JS code
which can "beep" the bits of the hex-file containing firmware (via
audio). Second - bootloader for target MCU which uses ADC pin to
"listen" to those beeps via direct wire connected to 3.5 mm audio jack plugged into smartphone - and "burn" incoming data into flash memory.
This works (if you are curious to try, it could be found in my
github page by same username) - however there is a sudden issue:
almost half of students use mobile phones without 3.5mm jack - as
nowadays it is the era of wireless headphones already, I missed the
fact!
So now I'm looking for further, alternative approaches. For example:
- attaching microphone to ADC pin instead of wired connector; code
should be beeped out via built-in speaker of the smartphone (it would
be a bit noisy class, of course) - I actually tried, but was not yet
able to come up with signal recognition algorithm of good enough
quality.
Hi Friends!
Briefly: considering ways of uploading code to microcontroller
(particularly some Atmel's AtMega - same as used for Arduino) from the smartphone.
- blinking data with display and catching it with photo-transistor
attached to ADC or digital pin, haven't tried for it seems like bitrate
would be very low (even though we generally need to upload firmware of
few dozens bytes).
Thus I'm open to any ideas / hints / articles on improving either of
these two approaches - or perhaps something completely different which I
may have missed.
On 27/03/2024 05:10, RodionGork wrote:
Hi Friends!
Briefly: considering ways of uploading code to microcontroller
(particularly some Atmel's AtMega - same as used for Arduino) from the
smartphone.
<snip>
- blinking data with display and catching it with photo-transistor
attached to ADC or digital pin, haven't tried for it seems like
bitrate would be very low (even though we generally need to upload
firmware of few dozens bytes).
Maybe play a suitable (uncompressed?) video with bits encoded as frames? Don't ask me how, just a thought.
Thus I'm open to any ideas / hints / articles on improving either of
these two approaches - or perhaps something completely different which
I may have missed.
Hi Friends!
Briefly: considering ways of uploading code to microcontroller
(particularly some Atmel's AtMega - same as used for Arduino) from the smartphone.
In details:
Programming MCUs (e.g. uploading firmware into their ROM) usually happens via some proprietary interface (using SPI in case of AVR), or UART, or JTAG.
This generally involves dedicated software on the side of computer and
some hardware (USB to UART or dedicated "serial programmer").
Suppose we want to be able to write simple code using mobile phone - situation I met with my class of 15+ students with no dedicated lab having 15+ computers.
I tried creating a small system containing two parts: First - html
web-page with a textarea to write assembly code, built-in AVRA assembly compiler (just compiled to javascript) - and some JS code which can
"beep" the bits of the hex-file containing firmware (via audio). Second - bootloader for target MCU which uses ADC pin to "listen" to those beeps
via direct wire connected to 3.5 mm audio jack plugged into smartphone -
and "burn" incoming data into flash memory.
This works (if you are curious to try, it could be found in my github
page by same username) - however there is a sudden issue: almost half of students use mobile phones without 3.5mm jack - as nowadays it is the era
of wireless headphones already, I missed the fact!
So now I'm looking for further, alternative approaches. For example:
- attaching microphone to ADC pin instead of wired connector; code should
be beeped out via built-in speaker of the smartphone (it would be a bit
noisy class, of course) - I actually tried, but was not yet able to come
up with signal recognition algorithm of good enough quality.
- blinking data with display and catching it with photo-transistor
attached to ADC or digital pin, haven't tried for it seems like bitrate
would be very low (even though we generally need to upload firmware of few dozens bytes).
Thus I'm open to any ideas / hints / articles on improving either of
these two approaches - or perhaps something completely different which I may have missed.
On 27/03/2024 05:10, RodionGork wrote:
Hi Friends!
Briefly: considering ways of uploading code to microcontroller
(particularly some Atmel's AtMega - same as used for Arduino) from the
smartphone.
<snip>
- blinking data with display and catching it with photo-transistor
attached to ADC or digital pin, haven't tried for it seems like
bitrate would be very low (even though we generally need to upload
firmware of few dozens bytes).
Maybe play a suitable (uncompressed?) video with bits encoded as frames? Don't ask me how, just a thought.
Thus I'm open to any ideas / hints / articles on improving either of
these two approaches - or perhaps something completely different which
I may have missed.
Hi Friends!
Briefly: considering ways of uploading code to microcontroller
(particularly some Atmel's AtMega - same as used for Arduino) from the smartphone.
In details:
Programming MCUs (e.g. uploading firmware into their ROM) usually
happens via
some proprietary interface (using SPI in case of AVR), or UART, or JTAG.
This generally involves dedicated software on the side of computer and
some hardware (USB to UART or dedicated "serial programmer").
Suppose we want to be able to write simple code using mobile phone - situation I met with my class of 15+ students with no dedicated lab
having 15+ computers.
I tried creating a small system containing two parts: First - html
web-page with a textarea to write assembly code, built-in AVRA assembly compiler (just compiled to javascript) - and some JS code which can
"beep" the bits of the hex-file containing firmware (via audio). Second
- bootloader for target MCU which uses ADC pin to "listen" to those
beeps via direct wire connected to 3.5 mm audio jack plugged into
smartphone - and "burn" incoming data into flash memory.
This works (if you are curious to try, it could be found in my github
page by same username) - however there is a sudden issue: almost half of students use mobile phones without 3.5mm jack - as nowadays it is the
era of wireless headphones already, I missed the fact!
So now I'm looking for further, alternative approaches. For example:
Hi Friends!firmware (via audio). Second - bootloader for target MCU which uses ADC pin to "listen" to those beeps via direct wire connected to 3.5 mm audio jack plugged into smartphone - and "burn" incoming data into flash memory.
Briefly: considering ways of uploading code to microcontroller (particularly some Atmel's AtMega - same as used for Arduino) from the smartphone.
In details:
Programming MCUs (e.g. uploading firmware into their ROM) usually happens via >some proprietary interface (using SPI in case of AVR), or UART, or JTAG. This generally involves dedicated software on the side of computer and some hardware (USB to UART or dedicated "serial programmer").
Suppose we want to be able to write simple code using mobile phone - situation I met with my class of 15+ students with no dedicated lab having 15+ computers.
I tried creating a small system containing two parts: First - html web-page with a textarea to write assembly code, built-in AVRA assembly compiler (just compiled to javascript) - and some JS code which can "beep" the bits of the hex-file containing
This works (if you are curious to try, it could be found in my github page by same username) - however there is a sudden issue: almost half of students use mobile phones without 3.5mm jack - as nowadays it is the era of wireless headphones already, Imissed the fact!
So now I'm looking for further, alternative approaches. For example:algorithm of good enough quality.
- attaching microphone to ADC pin instead of wired connector; code should be beeped out via built-in speaker of the smartphone (it would be a bit noisy class, of course) - I actually tried, but was not yet able to come up with signal recognition
- blinking data with display and catching it with photo-transistor attached to ADC or digital pin, haven't tried for it seems like bitrate would be very low (even though we generally need to upload firmware of few dozens bytes).
Thus I'm open to any ideas / hints / articles on improving either of these two approaches - or perhaps something completely different which I may have missed.
RodionGork wrote:
Hi Friends!
Briefly: considering ways of uploading code to microcontroller
(particularly some Atmel's AtMega - same as used for Arduino) from the smartphone.
In details:
Programming MCUs (e.g. uploading firmware into their ROM) usually happens via
some proprietary interface (using SPI in case of AVR), or UART, or JTAG.
This generally involves dedicated software on the side of computer and
some hardware (USB to UART or dedicated "serial programmer").
Suppose we want to be able to write simple code using mobile phone -
situation I met with my class of 15+ students with no dedicated lab having 15+ computers.
I tried creating a small system containing two parts: First - html
web-page with a textarea to write assembly code, built-in AVRA assembly
compiler (just compiled to javascript) - and some JS code which can
"beep" the bits of the hex-file containing firmware (via audio). Second -
bootloader for target MCU which uses ADC pin to "listen" to those beeps
via direct wire connected to 3.5 mm audio jack plugged into smartphone -
and "burn" incoming data into flash memory.
This works (if you are curious to try, it could be found in my github
page by same username) - however there is a sudden issue: almost half of
students use mobile phones without 3.5mm jack - as nowadays it is the era
of wireless headphones already, I missed the fact!
So now I'm looking for further, alternative approaches. For example:
- attaching microphone to ADC pin instead of wired connector; code should
be beeped out via built-in speaker of the smartphone (it would be a bit
noisy class, of course) - I actually tried, but was not yet able to come
up with signal recognition algorithm of good enough quality.
- blinking data with display and catching it with photo-transistor
attached to ADC or digital pin, haven't tried for it seems like bitrate
would be very low (even though we generally need to upload firmware of few dozens bytes).
Thus I'm open to any ideas / hints / articles on improving either of
these two approaches - or perhaps something completely different which I may have missed.
Keep your audio interface but plug it into a Bluetooth audio receiver (or cannibilze an old Bluetooth headphone and connect your audio interface to where the earpiece was). Then students can connect audio via Bluetooth.
A worthy project for your students, and the solution could be used around the world!
Presumably, you want this to be an interface that each student can "takehome"
some control over the MCU-end of the system. Is this anOTC "module"?
Look into the "Kansas City Standard"
I would assume you really would like a bidirectional link.
If every phone supports a microSD card
The USB charging/data port would be another obvious candidate
A BT interface on your MCU module
You can also hack the NFC interface
The (camera) "flash" LED might be easy to drive
you could paint a barcode image on the phones screen
Maybe play a suitable (uncompressed?) video with bits encoded as frames?Don't ask me how, just a thought.
Keep your audio interface but plug it into a Bluetooth audio receiver
Maybe they could upload the code to a web site, and you could havehardware in the student lab that loads the target machines
Coding on a phone sounds nasty.
Hi Friends!
Thus I'm open to any ideas / hints / articles on improving either of
these two approaches - or perhaps something completely different which I
may have missed.
some control over the MCU-end of the system. Is this an
OTC "module"?
I'm not sure what is OTC module.
AVR microcontrollers were picked as those with
probably simplest assembly language, particularly these are bare ATMega8L chips
in DIP-28. Initially kids plugged them into breadboard, added battery, couple buttons and LED - and audio-connector of course - and voila (see image linked
above). That was not very stable so we invested 2-3 lessons in building hand-made PCBs.
Look into the "Kansas City Standard"
Thanks, I glanced over but need to dive more into details. It also reminded me
of approach used with ZX spectrum, need to check how exactly it worked...
I would assume you really would like a bidirectional link.
Well, this would be an improvement though more wiring is needed and audio port
with mic input. Shall search for more info how 4-contact jack is implemented on
various smartphones... Though if uploading could be made more stable even with
one-way link, I'll stick to it for simplicity...
If every phone supports a microSD card
Surprising idea! never came to my mind, though I think there is no API to directly control SD card pins and with 8-bit MCU bootloader it is probably not
possible to accomodate for complicated code handling SD card IO... And yep, these are perhaps more rare than audio jacks
The USB charging/data port would be another obvious candidate
Unless I'm mistaken it works only with phones which have USB "on the go" variety, e.g. can work as USB-host?
A BT interface on your MCU module
We actually did use this previously (HC-05 or something alike), just with somewhat different firmware (also created by me) allowing an interactive BASIC
on Arduino or STM32. Here is a lousy video:
https://www.youtube.com/watch?v=q9JcWGs_VaI
However setting 15+ cheap bluetooth devices with shaky power supply - they were
not working fine
and it was sometimes painful experience. I admit I haven't thought of them for
uploading though
it will make straightorward flow. Perhaps shall switch to it if "audio" channel
couldn't be
improved after all, thanks :)
You can also hack the NFC interface
Here I'm a bit out of sync with technology - does all modern smartphones include NFC? And I think receiver needs a chip like 531 or 522 and some stuff around so it feels bit too complicated for school level...
The (camera) "flash" LED might be easy to drive
Very curious idea I completely missed, also not sure about throughput but need
to go and check first. Also it suggests using camera itself as a feedback... very interesting!
you could paint a barcode image on the phones screen
Ha-ha! that is also something I completely missed. I can easily program "running barcode" in an HTML page with javascript/canvas... Not sure if it will
work better than blinking display, but
it looks much more comprehensive to user... and seems more versatile (even up to printing barcode on a paper) - will think more about this, thanks!
I agree. But coding without anything is even worse. These are "facultative" classes of electronics happening once per week and we can't pretend on supplying ourselves with suitable auditorium with desktop computers or fetching
dozen-or-two spare laptops :)
A BT interface on your MCU module
We actually did use this previously (HC-05 or something alike), just with some
what different firmware (also created by me) allowing an interactive BASIC on Arduino or STM32. Here is a lousy video:
https://www.youtube.com/watch?v=q9JcWGs_VaI
However setting 15+ cheap bluetooth devices with shaky power supply - they were not working fine
and it was sometimes painful experience. I admit I haven't thought of them for uploading though
it will make straightorward flow. Perhaps shall switch to it if "audio" channel couldn't be
improved after all, thanks :)
Hi Friends! First of all thanks for all those replies. These are my first steps in usenet and I hardly expected such quick and multiple-sided discussion. Seems like some suggestions complement each other so I'll answer in the order of encountering themin replies.
A worthy project for your students, and the solution could be used around the world!
Thanks for your kind words. Actually it already can be used but probably I need to add more documentation/video, particularly about hardware setup. "Coding / beeping" page is here (you may click "compile" and then "burn" just for fun):
https://rodiongork.github.io/avr-mic-loader/
Setup may look as easy as here:
https://i.imgur.com/j6N3aNe.png
- and audio-connector of course - and voila (see image linked above). That was not very stable so we invested 2-3 lessons in building hand-made PCBs.Presumably, you want this to be an interface that each student can "take >home"
Yep (some of them already took it home and did some coding in "unsupervised" mode), moreover it would be fine to have interface which is easily and cheaply reproducible.
some control over the MCU-end of the system. Is this anOTC "module"?
I'm not sure what is OTC module. AVR microcontrollers were picked as those with probably simplest assembly language, particularly these are bare ATMega8L chips in DIP-28. Initially kids plugged them into breadboard, added battery, couple buttons and LED
ll stick to it for simplicity...Look into the "Kansas City Standard"
Thanks, I glanced over but need to dive more into details. It also reminded me of approach used with ZX spectrum, need to check how exactly it worked...
I would assume you really would like a bidirectional link.
Well, this would be an improvement though more wiring is needed and audio port with mic input. Shall search for more info how 4-contact jack is implemented on various smartphones... Though if uploading could be made more stable even with one-way link, I'
rare than audio jacksIf every phone supports a microSD card
Surprising idea! never came to my mind, though I think there is no API to directly control SD card pins and with 8-bit MCU bootloader it is probably not possible to accomodate for complicated code handling SD card IO... And yep, these are perhaps more
file from the server and uploaded it. It was just not very convenient when there are many people and few (or single) computer. But it was the most stable setup probably, that's true.The USB charging/data port would be another obvious candidate
Unless I'm mistaken it works only with phones which have USB "on the go" variety, e.g. can work as USB-host?
A BT interface on your MCU module
We actually did use this previously (HC-05 or something alike), just with somewhat different firmware (also created by me) allowing an interactive BASIC on Arduino or STM32. Here is a lousy video:
https://www.youtube.com/watch?v=q9JcWGs_VaI
However setting 15+ cheap bluetooth devices with shaky power supply - they were not working fine
and it was sometimes painful experience. I admit I haven't thought of them for uploading though
it will make straightorward flow. Perhaps shall switch to it if "audio" channel couldn't be
improved after all, thanks :)
You can also hack the NFC interface
Here I'm a bit out of sync with technology - does all modern smartphones include NFC? And I think receiver needs a chip like 531 or 522 and some stuff around so it feels bit too complicated for school level...
The (camera) "flash" LED might be easy to drive
Very curious idea I completely missed, also not sure about throughput but need to go and check first. Also it suggests using camera itself as a feedback... very interesting!
you could paint a barcode image on the phones screen
Ha-ha! that is also something I completely missed. I can easily program "running barcode" in an HTML page with javascript/canvas... Not sure if it will work better than blinking display, but
it looks much more comprehensive to user... and seems more versatile (even up to printing barcode on a paper) - will think more about this, thanks!
Maybe play a suitable (uncompressed?) video with bits encoded as frames? >Don't ask me how, just a thought.
That may be working, right. Not necessarily video, it is possible to programmatically blink an area of screen etc...
Keep your audio interface but plug it into a Bluetooth audio receiver
Interesting, never thought of this approach - shall investigate it further, thanks.
Maybe they could upload the code to a web site, and you could havehardware in the student lab that loads the target machines
funny, but you described exactly approach we used year ago - they uploaded code to my server, then rushed to the single laptop at the center which had USB programmer attached - and here entered pin-code by which small script fetched the compiled HEX-
:)Coding on a phone sounds nasty.
I agree. But coding without anything is even worse. These are "facultative" classes of electronics happening once per week and we can't pretend on supplying ourselves with suitable auditorium with desktop computers or fetching dozen-or-two spare laptops
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 415 |
Nodes: | 16 (2 / 14) |
Uptime: | 160:56:02 |
Calls: | 8,707 |
Calls today: | 1 |
Files: | 13,270 |
Messages: | 5,951,461 |