Go Down

Topic: Will Arduino work for me? A reprogrammable alarm clock as my first hw project (Read 259 times) previous topic - next topic

junebug12851

I want to make my first hardware project and I've heard a lot about the Arduino so I'm asking here to see if it will work for my needs. (* ^ ω ^)

My goal is to have an alarm clock, the LCD screen will be very simple, typical digit display where the digit lights that make up the numbers and stuff can be turned on or off (I guess another word is not pixels but digit lights if that makes any sense) --- However if it's overall easier to have an LCD screen that would also work and I can just render the digits like emulating them.

I would ideally want a 4Mhz processor but 8Mhz will do since it seems to be more common. I do want onboard ROM and SRAM as being pretty important but I need an address space at least up to 0x4FF, but 16-bit address space bus would be most ideal.

With my rough markup, I want 0xFF amount of internal ROM but I may double that, I want external ram and external rom via an SD card that's banked each 0xFF in size (more on that below and again may double those numbers), Non-battery backed internal RAM of 0xFF in size, and a section of RAM reserved for hardware control of size 0xFF (individual digits lights, sound, etc...). I want the processor to linearly have access to this space from address 0x000 to 0x4FF even though they may reside in different components

Part of the control RAM will be internal banking bytes at fixed location to determine banking number for reading from external rom and reading/writing to external ram

In an ideal situation, the internal ROM will just contain very minimal code to prepare to run off the SD Card which will then take over and run the clock. at any time the SD Card could be removed as well as any External RAM data that was programmed to be saved, modified, deleted, whatever, then placed back in the clock effectively allowing reprogramming of the clock or giving a totally different purpose, it'd be up to me.

Internal RAM would just be temporary working RAM for when the clock is on and for the programming to use and the control section of the internal RAM also an additional 0xFF bytes would be for actual rendering and direct control

If your wondering what the point of this is, theres absolutely no point at all, it's more or less a life-long dream to accomplish I just never got into hardware before to accomplish it. It just seems super cool to be able to have total control over the internal workings of something as simple as an alarm clock and to have a full capability to hack around with it, make it do different things, or perhaps make a game or something crazy with those 9 or so lights, maybe even a config screen or multiple screens, maybe change the audio pulsing, maybe have a customizable greeting message, I don't know the sky would be the limit on this completely pointless but fun sounding project (⌒‿⌒)

Here's the rough memory map I have in mind (⌒ω⌒)

Code: [Select]
0x000-0x0FF - Internal ROM
0x100-0x1FF - External ROM on SD Card
0x200-0x2FF - External RAM on SD Card
0x300-0x3FF - Internal RAM
0x400-0x4FF - Control (Digits, Sound, External Banking etc...)


But I'm posting here not just to ask if Arduino would be suitable but if things need to be simplified much further, like if I'm going over the top and it'd be better to just have 1 form of memory for example or something or I dunno, I'm willing to take other suggestions (´・ᴗ・ ` )

Thanks in advance (๑˃ᴗ˂)
☆*:.。.o(≧▽≦)o.。.:*☆

septillion

Why on earth do you have such specific demands on memory BEFORE you even started!???? ::)

And is this only your first hardware project or also your first micro controller project? If not, what is you experience? And what is your experience with C/C++?
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

PaulRB

Your requirements sound crazy and completely irrelevant and have nothing to do with building alarm clocks or games. You can do all those things with Arduino, but you seem to be concerned with details that you do not need to be worrying about.

Arduino cannot run code from an SD card. The SD card memory does not form part of the mcu's memory address space. The mcu communicates with the sd card controller over the SPI bus to transfer data between its ram memory and the SD card. If you make the usb socket exposed in your design, you can upload new code any time you like. I'm not clear what you need an SD card for in this design.

P.S. (* ^ ω ^) (⌒‿⌒)  (⌒ω⌒) (´・ᴗ・ ` ) (๑˃ᴗ˂) please stop this, it is annoying.

ChrisTenone

Hey Junebug',

You've got some older ideas of how computer architecture works. It's a new world now. ROM and RAM are older ideas. Ram still exists, but ROM is replaced with flash and EEPROM memory. With an Arduino, you have 2K of RAM, 32 K of flash memory and 1K of EEPROM, and they are all addressed separately.

To make an alarm clock, you can use the Arduino Integrated Development Environment (or IDE), which is a programming editor, compiler, and usb programmer to write very simple to very complex programs for an Arduino. Arduino programs are in standard C++, using the arduino.h library, which is automatically loaded by the IDE. An Alarm clock is a great first "complex" project. You should work through several of the Examples here.
I don't got to show you no stinkin' signature.

junebug12851

Ah sorry about the emoticons, I'll stop with them.

@septillion I have such specific requirements because it's a project I've been really thinking about for a long time now, I actually had even more specific requirements but lightened up on them when I posted here. For example I did modify a compiler locally on my computer to produce a custom opcode range with features added and others removed specifically tailored for my alarm clock that I was going to look into possibly ordering one day in the future from a manufacture. The custom processor with custom opcodes was more realistically based on an existing processor, just very stripped down, and after studying how other companies order custom processors that strip them down or add new features.

Also I did plan to have actual cartridges instead of an SDCard but I was trying to lighten up the requirements before posting on here (Details below)

I am very competent in C++, it was my 2nd programming language I learned and one one that I chose to really move to advance level before eventually deciding to move to other languages

@PaulRB I'm sorry, this is my first project so perhaps I should have gone a different route for it, in software I'm used to planning everything out in detail before implementing it but hardware I suppose is completely different then.

I find the old cartridge stuff from before I was born so absolutely fascinating for the different gaming devices, the idea that the console, whatever it is, would run some initial boot stuff and then transfer control over to a cartridge. I would love that in a simple alarm clock, the idea that you can just load an "Alarm Clock" ROM onto an sdcard to simulate a cartridge and insert it into an alarm clock to run it but in reality it would just be a generic device with an old retro LCD and simple buzzer sound but the freedom to make an "Alarm Clock" however you want in a device with such capability or even to make something completely different from an alarm clock absolutely intrigues me.

I never knew about not being able to run code off the SDCard, I knew that people designed custom cartridges for existing gaming systems both old and new such as the DSI that has an SDCard adaptation cartridge which code runs off of but perhaps I'm misunderstanding this for the Arduino.

@ChrisTenone I am very interested in older hardware before I was born so I guess I kind of live in that world a bit too much. Also is ROM not the same as EEPROM or is EEPROM easier to alter than older ROM styles. That would make sense though for modern computers I would imagine.

So your suggestion would be to pick a random Arduino board and just have fun and learn hardware getting used to the waters first doing random examples or tinkering in code before jumping in to a more complex project.

Thank you for everyones help so far
☆*:.。.o(≧▽≦)o.。.:*☆

septillion

Normal people make their requirements based on what they want to do, not what they want to use ;)

But if you changed compilers and messed with opcodes, that almost certainly means you're stuck with the processor you did that for and the language that compiler is made for...
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

junebug12851

But I did base all this on what I want to do which is a reprogrammable alarm clock, also a custom processor was just an example of a more specific design that I don't have to have and that I lightened up a bit before posting on here ^_^

Do you think I would be better off trying to design the chip myself using an older style chip with an address bus I can custom map and such and have an actual cartridge and more control over the components? I just feel it would be very far above my head given I'm just now entering hardware in general but I guess I picked Arduino because it felt more closer to the chip and raw memory than other solutions especially the raspberry pi which is just far too advanced and powerful and modern. Perhaps I can take a college class on hardware when I get into college and build a custom retro-style chip with custom components, a custom processor, and cartridge based system but I guess for now was hoping the Arduino would work more with how I had hoped.

Perhaps for now I can run off of SRAM within the Arduino even though it's far smaller than I had hoped which is why I really liked the memory banking idea for external memory just like the old retro consoles did but the more I look at it now the more I realize Arduino still uses modern technology and workflow so a total custom chip in the future might be the best solution. Arduino, I can see, is still way too modern so I've lost interest in it a bit now, but don't want to wait until I get to college and take however long it takes to get to that level.

Is there any way I can mod the chip by attaching something which allows externally executed code from the processor? or can the processor only execute code from within the internal components?

Thanks again for everyones help
☆*:.。.o(≧▽≦)o.。.:*☆

septillion

If your main goal is to use some old architecture, then use that old architecture. If you just want to run C/C++ code on a micro, the Arduino platform is fine. And yes, it's bare metal as in it's the only thing running on it (unlike a Raspberry which runs an OS). Only thing the Arduino framework does is give you nice cross platform functions.

And as far as memory, as long as you're not pissing it away it's plenty for most clock designs. Unless you want to do something very unusual...
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

junebug12851

Thanks for the summary, yea my goal is not to make any old clock, if I were to do that I'd go out to the store and buy one, my design is a bit unusual because I really want the whole thing to work off of removable memory like an oversimplified system with a few buttons, an lcd readout, and a buzzer that works off an external removable program and the external program may use minimal memory, may be something sophisticated and complex, or may even span a megabyte with a full-on game which is the point of banking.

So I guess, like you said, I'm overreaching the boundaries of Arduino and would be better fit to run on a custom chip with custom hardware.

Thanks again for everyones help.
☆*:.。.o(≧▽≦)o.。.:*☆

septillion

To me, it sounds like you are better of using a Raspberry Pi with an extra sd card (or just a USB stick). And just load an application (like Python or so) from the sd/usb an let it auto start it.

External memory can be used with some micro controllers (and note, Arduino isn't a single micro, it's a platform which supports multiple micros) but that usually isn't in the form of an sd-card but just EEPROM or something. Aka, it's not only that you overreached the boundaries of Arduino but of micro controllers in more general (although possible with the more complex ones).

Custom chips sounds a bit enthusiastic. I think you would then grant a place in a handful of people who designed there own chip for home use...
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

junebug12851

Thanks for the reply and I did mention above that anything would be ok, I never liked the SD Card idea but I added it because it sounded simpler, if having external ROM connected to the chip is better then I'm much more for that then an  sdcard.

So your saying the Arduino can execute off of external rom?
☆*:.。.o(≧▽≦)o.。.:*☆

PaulRB

your saying the Arduino can execute off of external rom?
I don't think that is what septillion was saying.

Most Arduino are based on the AVR range of MCUs. The AVR architecture does not have a unified address space, and code can only be executed from internal flash memory, as far as I know. However, it must be possible for a program to update the flash, because this is how the bootloader works.

But not all Arduino are based on AVR these days. There are many more MCU with different architectures that can now be programmed with the Arduino platform and IDE. Some of those have far more SRAM memory, and can execute code from SRAM, because they have unified address spaces. In other words they have a Von Neumann  architecture rather than Harvard architecture (if I remember my university lectures correctly from many many moons ago!).

westfw

It's certainly possible to load up an Arduino sketch that implements some sort of "virtual architecture" or VM that can run code loaded from various other places.  In that case, the memory/IO layout is whatever YOU set up in the VM, but the Arduino has to have resources far beyond that to implement the VM in the first place.
You could look at Bitlash, which implements a BASIC-like interpreter, or something like AMForth with does Forth on an AVR.
I don't know offhand whether there is anything that implements any of the "standard" VMs (JVM, PCode, etc); implementing such standards tends to get very large, very quickly :-(

In the SAMD (Arduino Zero) and better class, Python (in the form of "MicroPython" and "CircuitPython" are catching on.  Adafruit in particular has been adding features (like SPI flash) to their Arduino-like SAM boards to better support Python.


Quote
Code: [Select]
0x000-0x0FF - Internal ROM
0x100-0x1FF - External ROM on SD Card

As a quick opinion, 256 bytes is woefully inadequate to support "programs" written in any modern high-level language.

junebug12851

I really dislike high level languages which is why my original goal was raw assembly with bank switching and why my original goal was my own custom processor which I already have custom assembly string and opcodes mapped out to based on a modified but very stripped down z80 with some specific features added in unique to this project and opcodes properly mapped out. I even have a compiler already setup modified from an existing z80 compiler to compile to this proper opcode mapping for this custom processor. In that case 256 bytes would be sufficient for a very tiny and compressed program and that also was the whole point of external banking. I did, however say 256 bytes was a rough sketch and I may double or tripple all the 256 byte sizes as well as make some sections smaller or larger.

However I understand with the Arduino there are limits and what I described above goes above and beyond what the board was designed for which is why I toned down the initial requirements from a custom modified processor to whatever processor came with the Arduino and from raw assembly to C++, and from custom cartridges to either Arduino's own internal memory or perhaps added on external rom or something.

I'm fairly new to hardware and hardware virtualization, my experience only goes down to the old retro raw opcodes and assembly and raw processor manipulation with stack pointers and such as well as unified address from the scope of a processor so I'm unfamiliar with those terms in the scope of the hardware itself.

With that said I do have a few questions:

1. A VM sounds very cumbersome like the JVM for example, are you saying for me to use the arduino processor to emulate this address space and opcodes? That would be too cumbersome and bulky, I already can write an emulator for it on the computer and a computer would be much more adept than a tiny low powered board. The point of the board was to natively implement some degree of the program forgoing the need for an emulation or VM, it's also why I didn't want a raspberry pi because I would just be writing some program to emulate an alarm clock purely in code. Or did I misunderstand the VM?

2. What is an AVR and MCUs, like I said I only know hardware from a the perspective of a retro processor so I'm unfamiliar with those terms?

I'm very interested in retro hardware so I rather deeply live in that world outside of school and am unfamiliar with a lot of the modern stuff that's out, that's why I'm thinking about learning hardware when I get to college although they'll probably teach modern hardware from when I was growing up which I hate ._. I feel everything trying to be run all in software on an all-in-one super powered board setup to run anything. I really like the old hardware from before I was born that was mostly all in assembly and required a special hardware setup for what your trying to do rather than generic board and generic processors with boatloads of memory and processing power to do anything.

What were you mentioning about the board that use Havard architecture but Arduino can load onto? Are there any specific examples and such?

As usual thanks for everyones help ^_^
☆*:.。.o(≧▽≦)o.。.:*☆

PaulRB

Check Wikipedia for definitions of MCU and AVR.

Many newer MCU that can be programmed with Arduino language/IDE are 32-bit designs based on ARM cores. For example Maple Mini. These have architectures that allow code to be executed from SRAM memory.

P.S.  ._.  ^_^ I don't know if you even realise, but you are still doing it.

Go Up