Bitcoin Forum

Bitcoin => Mining => Topic started by: interfect on May 26, 2011, 07:22:18 AM



Title: Arduino Miner?
Post by: interfect on May 26, 2011, 07:22:18 AM
Hey,

Does anyone know if there is a miner available for the Arduino already? I know it probably wouldn't be cost- or power-effective to mine on an Arduino, but if nobody else has done it yet I was thinking of attempting it.

On that note, is there documentation on the mining algorithm? What do I need to do with what I get from getwork?


Title: Re: Arduino Miner?
Post by: xyzzy on May 26, 2011, 07:50:44 AM
looks like someone already ported SHA256 to lolduino, you're halfway there!

http://avrcryptolib.das-labor.org/trac/browser/sha256-asm.S?rev=3


Title: Re: Arduino Miner?
Post by: commlinx on May 26, 2011, 08:26:26 AM
Sounds like a cool little project, when I read the topic I thought it was going to be someone with plans of clustering thousands of them :D. Maybe you could port the following CPU miner using the assembler hash above:

http://forum.bitcoin.org/index.php?topic=1925.0

I haven't used it but checked the code and it looks pretty clean and un-bloated. What were you planning, getting work from the PC and pumping work and results over the serial port, or using a shield to do the network comms directly from the AVR?


Title: Re: Arduino Miner?
Post by: interfect on May 27, 2011, 04:28:58 AM
Sounds like a cool little project, when I read the topic I thought it was going to be someone with plans of clustering thousands of them :D. Maybe you could port the following CPU miner using the assembler hash above:

http://forum.bitcoin.org/index.php?topic=1925.0

I haven't used it but checked the code and it looks pretty clean and un-bloated. What were you planning, getting work from the PC and pumping work and results over the serial port, or using a shield to do the network comms directly from the AVR?

I don't have an Ethernet shield, so I'll probably have a program on a PC to do the JSON and feed work to the board. That link looks pretty useful; there's also a fairly clean-looking Python implementation on the same person's Github.


Title: Re: Arduino Miner?
Post by: eturnerx on May 27, 2011, 03:47:58 PM
The Arduino microprocessors are really weak so you'll probably not get much out of them in terms of Hash/s. What might work is wiring up some custom SHA256 IC's and using the Arduino to farm work to them - of course with the PC doing the comms.


Title: Re: Arduino Miner?
Post by: merlz on May 30, 2011, 05:29:34 AM
I'd be happy to play around with this/improve this if you can get some initial code running :-)


Title: Re: Arduino Miner?
Post by: KnuttyD on May 30, 2011, 06:24:53 AM
Haha hey, I did a lot of work with the Arduino a little while ago, maybe I can help with this project. Here is an example of a little program I wrote to bit bang PWM to some RGB led's:
http://www.youtube.com/watch?v=C3s8qDhUwlo

Good luck!


Title: Re: Arduino Miner?
Post by: BombaUcigasa on May 30, 2011, 09:27:34 AM
The Arduino microprocessors are really weak so you'll probably not get much out of them in terms of Hash/s. What might work is wiring up some custom SHA256 IC's and using the Arduino to farm work to them - of course with the PC doing the comms.

Indeed, they are weak, but let's not forget once you have the right chip and board schematics, you can put them in a small "farm".

http://t2.gstatic.com/images?q=tbn:ANd9GcTcAncOW74N_G5eI6GTcxP253x9u65UrknAgXmTgLmoyliwDW6TGg

As you can see above, after prototyping, the actual implementation surface could be as little as 2cm^2 per core. Also consider running a parallel algorithm on them, such that they use all cores on a board for a single hash, instead of each core doing it's own complete hashing. An USB chip and an USB connection and a PC are needed to actually validate the hashes and collect the results. It's sunny outside, plug them into a PV cell and when the sun shines you get free bitcoins straight from the source...

Could someone do the math in terms of Mhash/s for them? (would it be something like 20Khash/s for a single one which needs 20 years for hardware breakeven?)

From the specs:
- Up to 20 MIPS throughput at 20MHz
- Operating voltage: ATmega48/88/168: 0 - 10MHz @ 2.7V - 5.5V, 0 - 20MHz @ 4.5V - 5.5V
- Power consumption: 250μA at 1MHz, 1.8V
- Price per 1000 units: < 2.5$


How 1000 of them look like:
http://www.wvshare.com/img/photos/at_tray_tqfp32_l.jpg


Title: Re: Arduino Miner?
Post by: nallar on May 30, 2011, 10:01:07 AM
I'd recommend that this is not done using Arduinos - it'd be more power efficient, and better MH/$ to use PIC32MX microcontrollers.
(Although it can be damn hard to get a toolchain set up on Linux because they only released the source for what they have to release... :()

Assuming it takes 1984 cycles to do a single SHA256(which it should), you'd get (80MHz/(1984*2)) = (80 * 100 000 000) / 3968 = 2 016 129.03 hashes per second. (I bet I've screwed something up there, somehow :))
Of course, I've only included the time for the two hashes. (which is wrong, because you can optimise away part of the last hash, if my beliefs are correct, anyway?), and none of the checking/control stuff. :)
In this case, I still think you'd only get ~50MH/s for $200. :(
(THIS IS NOT AT BULK PRICING THOUGH! If you were to buy say, a thousand of them, you might find it to be very different :))


And that's at a maximum cost of 8$ + support components. (decoupling capacitors, PCBs, etc)(quite probably less, I can't be bothered to check :D)

An Arduino would take more clock cycles to do it, I don't know how many, because it's not 32Bit. And it runs more slowly too, so it's unlikely to get you as much money in return.


Title: Re: Arduino Miner?
Post by: commlinx on May 30, 2011, 10:07:39 AM
Could someone do the math in terms of Mhash/s for them? (would it be something like 20Khash/s for a single one which needs 20 years for hardware breakeven?)
Looking at the hash code above there's close to 1000 opcodes, and it's not entirely unrolled, if it was that would be 20k SHA hashes. That would be 10khash/s in Bitcoin terms (2 SHA per hash) but briefly looking I'd expect < 1khash/s. I can't be bothered but the free AVR Studio package has a simulator you could run it through to see the instruction cycles taken.

If you were seriously contemplating it a small ARM is less than a dollar more expensive, and I'd expect would be about 8 times faster because most of the calcs are 32 bit and they run over double the clock rate. The CPU mining comparison suggests 110khash for a 528MHz ARM 11 so I suspect a low-cost ARM (50MHz odd) would only come in around 10khash. Compared to say the 5970 I use that would need about 7000 of them at $2 a pop to compete. Also to compete on power it would need to use about 4mA a chip, even most AVRs you more than that at full tilt.

I think the OP had the right idea to just treat it as an interesting little project ;)

Edit - just realised above is out by an order of magintude, making it even worse.


Title: Re: Arduino Miner?
Post by: merlz on May 30, 2011, 10:37:10 AM
I think it would be both interesting and useful to have a working codebase and example that could be used with microcontrollers.  This project's aim isn't to produce something with a superior efficiency to current solutions, but if somebody does want to try going down that path it would be nice to have a codebase and/or ideas to work from. 

I think something that could use one or more arduino's to do the calculations in an efficient manner would be a net positive for other projects as well.


Title: Re: Arduino Miner?
Post by: BombaUcigasa on May 30, 2011, 11:11:26 AM
The arduino advantage is once you have a working prototype, it costs around 2.5$ per core to build your implementation, very little costs for the surrounding parts, and can be implemented with low-tech tools like a soldering iron, some PCBs and etching solution. The proposed alternatives require more development work, more expensive parts and assemblies.


Title: Re: Arduino Miner?
Post by: commlinx on May 30, 2011, 11:27:19 AM
Sure arduino is slow as hell, but it's virtually free to use in terms of electricity 0.7mAV per core? Or say you build a 100 cores board (250$), that would draw 70mW?
I use AVRs a lot but have never used an Arduino as such. But for example first one I just found was a nano using an ATmega168, you need 4.5V to get 20MHz and the datasheet lists 12mA @5V for 8MHz. It would be higher than that for 20MHz but even if it wasn't that would still be 4.5 x 12mA (current would be a little lower at 4.5V at 8MHz) = 54mW per chip. The lower currents you see in sales blurbs are normally running at 32KHz and/or using the various standy modes. The relationship to clock rate is normally "somewhat" linear, so I'd expect under 100mW a chip at 20MHz, maybe more like 70mW like you said but for each chip not 100.


Title: Re: Arduino Miner?
Post by: BombaUcigasa on May 30, 2011, 11:58:25 AM
Sure arduino is slow as hell, but it's virtually free to use in terms of electricity 0.7mAV per core? Or say you build a 100 cores board (250$), that would draw 70mW?
I use AVRs a lot but have never used an Arduino as such. But for example first one I just found was a nano using an ATmega168, you need 4.5V to get 20MHz and the datasheet lists 12mA @5V for 8MHz. It would be higher than that for 20MHz but even if it wasn't that would still be 4.5 x 12mA (current would be a little lower at 4.5V at 8MHz) = 54mW per chip. The lower currents you see in sales blurbs are normally running at 32KHz and/or using the various standy modes. The relationship to clock rate is normally "somewhat" linear, so I'd expect under 100mW a chip at 20MHz, maybe more like 70mW like you said but for each chip not 100.
I read the "active" figure for the 1Mhz@1.8V, and extrapolated to 5V. Don't know how to compensate for speed. So let's look at the document again

http://www.atmel.com/dyn/resources/prod_documents/doc2545.pdf

page 304 - Active 8Mhz@12mA (5V)
page 315 - Active supply current vs. frequency (1MHz - 24MHz) chart, it seems that 24Mhz, 5.5V needs 15mA. The number we were looking for was that 20Mhz 5V needed 11mA.
page 319 - Idle supply current vs. frequency (1MHz - 24MHz) chart, it seems that 24Mhz, 5.5V needs 4mA.

So I stand corrected, each core requires 55mAV (or 83mAV overclocked).


Title: Re: Arduino Miner?
Post by: commlinx on May 30, 2011, 12:12:04 PM
So I stand corrected, each core requires 55mAV (or 83mAV overclocked).
Sounds about right, so if my "extremely optimistic" 10khash/s at the higher clock rate was realised it would be 8.3W per mhash/s. To match a 5970 at 700mhash/s you'd need 70,000 chips and 5810W. Must reiterate I think it's a cool project, just once anyone does it you're probably better to offer your newly developed skills in exchange for BTC rather than using it to mine with ;D.


Title: Re: Arduino Miner?
Post by: merlz on May 30, 2011, 12:43:01 PM
All the arguments about profitability aside, how would one actually go about implementing it in a sensible way?  what's the compatibility list?  How much memory do we actually need to calculate the hash, and how do we send/receive it efficiently?

All these questions are good ones to answer in an arduino implementation, and could have efficiency consequences for custom boards/IC's afterward.


Title: Re: Arduino Miner?
Post by: commlinx on May 30, 2011, 01:03:15 PM
All the arguments about profitability aside, how would one actually go about implementing it in a sensible way?  what's the compatibility list?  How much memory do we actually need to calculate the hash, and how do we send/receive it efficiently?

All these questions are good ones to answer in an arduino implementation, and could have efficiency consequences for custom boards/IC's afterward.
AVR has a GNU toolchain so you'd just need to split the code above, do the hashing on an AVR that doesn't need much RAM and pass it back to a PC say over a serial port. For the reasons above anything using an AVR would be a waste of time for a custom board, and a custom IC would be an ASIC. Apart from being very expensive starting with an AVR isn't even vaguely how you'd go about starting an ASIC design. There's a thread here about an open source FPGA design which would be more likely a starting point for an ASIC:

http://forum.bitcoin.org/index.php?topic=9047.0

But for an ASIC you'd want to count on dropping over $100K even if you were an expert in the area.


Title: Re: Arduino Miner?
Post by: Littleshop on May 30, 2011, 04:06:25 PM
The arduino advantage is once you have a working prototype, it costs around 2.5$ per core to build your implementation, very little costs for the surrounding parts, and can be implemented with low-tech tools like a soldering iron, some PCBs and etching solution. The proposed alternatives require more development work, more expensive parts and assemblies.

What does a 5870 cost per core?  1600 cores/$320 (for easy calc) so maybe 5 cents a core?


Title: Re: Arduino Miner?
Post by: BombaUcigasa on May 30, 2011, 04:41:47 PM
All the arguments about profitability aside, how would one actually go about implementing it in a sensible way?  what's the compatibility list?  How much memory do we actually need to calculate the hash, and how do we send/receive it efficiently?

All these questions are good ones to answer in an arduino implementation, and could have efficiency consequences for custom boards/IC's afterward.

Looking at the numbers, I don't think anyone is going to find out anytime soon :D

The fact that the hardware breakeven is longer than the duration of life for the device, and that while interesting to get a C/lua/python/ASM implementation running in single-core or multi-core configurations, the lessons would provide too little for benefits on other platforms. My suggestion is to start with the public code in public repositories on all the miners published so far and attempt to rewrite parts of them for the arduino.

Might as well start directly on those other platforms. I'm going to watch for an android implementation now, surely that's more accessible and powerful than any arduino implementation might go.


Title: Re: Arduino Miner?
Post by: wolftaur on May 30, 2011, 04:59:46 PM
Some of the LPCs can be had for 60 cents for 1K chip count. That's a 75MHz ARM core instead of a 20MHz AVR core... So a much lower cost per core, a much higher performance per core. I'm a fan of AVRs, but still, there's such a thing as trying too hard -- which is why I laugh at everyone still trying to do "real work" on their CP/M system.

--Keith


Title: Re: Arduino Miner?
Post by: BombaUcigasa on May 30, 2011, 06:31:09 PM
Some of the LPCs can be had for 60 cents for 1K chip count. That's a 75MHz ARM core instead of a 20MHz AVR core... So a much lower cost per core, a much higher performance per core. I'm a fan of AVRs, but still, there's such a thing as trying too hard -- which is why I laugh at everyone still trying to do "real work" on their CP/M system.

--Keith
Let us read from the Big Book  (http://ics.nxp.com/support/documents/microcontrollers/pdf/user.manual.lpc17xx.pdf)of things and witness it's power....
- ARM Cortex-M3 processor, running at frequencies of up to 120 MHz on high speed versions (LPC1769 and LPC1759), up to 100 MHz on other versions, around 100 MIPS?
- Price around 7.5$ for large quantities for most package forms
- no power usage details, possibly less than100mW  (http://www.keil.com/boards/cortexm.asp)at 2-5V?
- requires board components for development/implementation worth around 10-20$?

http://shop.ngxtechnologies.com/images/BlueboardLPC1768H2.jpg

So it looks like 100Khash/s for 10$/core using 300mW. Maybe you can buy them cheaper.


Title: Re: Arduino Miner?
Post by: callmelordjohn on May 19, 2016, 01:29:01 AM
is there any update on this ?


Title: Re: Arduino Miner?
Post by: bitcoineverything on May 19, 2016, 07:29:34 AM
This is interesting but mining needs a lot of processing power. I don't think Arduino can run the mining software. Most CPUs are working at GHz clockspeeds and Arduinos are not. There were RPis made for it but still they are weak.


Title: Re: Arduino Miner?
Post by: notlist3d on May 19, 2016, 11:03:06 PM
is there any update on this ?

Arduino's were just not made for running mining software.  You can program them... but the project is not something like running a full linux OS.   You just will find it's made for other things.

What you need is a RPI for 30 dollars or so.  And it works fine as it was made as a mini computer. 


Title: Re: Arduino Miner?
Post by: alh on May 20, 2016, 04:46:23 PM
While this might be an interesting or fun project, it's clearly in the "Can I make it work" category, kinda like that guy that implemented the SHA256 algorithm on a late 1950's IBM system (i.e. the 1401 CPU). It's important to understand the realities of such an effort.

For a moment, let's assume you could make a single Arduino do 1 MILLION hashes in a second. Sounds like a lot doesn't it? To put it in perspective though, the $25 Compac USB stick from sidehack does 8 BILLION hashes in one second. So to match the Compac hashrate you'll need 8 THOUSAND Arduino gadgets.

Just something to consider.


Title: Re: Arduino Miner?
Post by: Lux_Gamer on August 04, 2016, 10:06:07 AM
I have designed a portable raspberry pi zero computer.
The raspberry pi is already in use for folding.
Now i want a low powerd computer a arduino for mining bitcoins or other currency doesnt really matter.
I know i never get my money back but it is more for the fun.
Now is my quastion is there already somen one who had done it on a arduino?

Sorry for my bad english hope you understand.


Title: Re: Arduino Miner?
Post by: leowonderful on August 07, 2016, 02:24:31 PM
I have designed a portable raspberry pi zero computer.
The raspberry pi is already in use for folding.
Now i want a low powerd computer a arduino for mining bitcoins or other currency doesnt really matter.
I know i never get my money back but it is more for the fun.
Now is my quastion is there already somen one who had done it on a arduino?

Sorry for my bad english hope you understand.

AFAIK no, and especially not for anything besides SHA256, let alone folding or even Scrypt. I don't see many people working on something like this in the future, either, as the hashrate will probably be so low that you'll never get any shares. The CPU in most arduino units are pretty obsolete, even compared with many smartphones. I'd just recommend that you buy some more pis to mine with, as it'll take at least a few months for anything to get started with this, if at all anything happens.