Bitcoin Forum
April 27, 2024, 01:52:32 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Arduino Miner?  (Read 31523 times)
interfect (OP)
Full Member
***
Offline Offline

Activity: 141
Merit: 100


View Profile
May 26, 2011, 07:22:18 AM
 #1

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?
1714182752
Hero Member
*
Offline Offline

Posts: 1714182752

View Profile Personal Message (Offline)

Ignore
1714182752
Reply with quote  #2

1714182752
Report to moderator
I HATE TABLES I HATE TABLES I HA(╯°□°)╯︵ ┻━┻ TABLES I HATE TABLES I HATE TABLES
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714182752
Hero Member
*
Offline Offline

Posts: 1714182752

View Profile Personal Message (Offline)

Ignore
1714182752
Reply with quote  #2

1714182752
Report to moderator
1714182752
Hero Member
*
Offline Offline

Posts: 1714182752

View Profile Personal Message (Offline)

Ignore
1714182752
Reply with quote  #2

1714182752
Report to moderator
1714182752
Hero Member
*
Offline Offline

Posts: 1714182752

View Profile Personal Message (Offline)

Ignore
1714182752
Reply with quote  #2

1714182752
Report to moderator
xyzzy
Newbie
*
Offline Offline

Activity: 8
Merit: 0


View Profile
May 26, 2011, 07:50:44 AM
 #2

looks like someone already ported SHA256 to lolduino, you're halfway there!

http://avrcryptolib.das-labor.org/trac/browser/sha256-asm.S?rev=3
commlinx
Full Member
***
Offline Offline

Activity: 294
Merit: 100



View Profile
May 26, 2011, 08:26:26 AM
 #3

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 Cheesy. 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?
interfect (OP)
Full Member
***
Offline Offline

Activity: 141
Merit: 100


View Profile
May 27, 2011, 04:28:58 AM
 #4

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 Cheesy. 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.
eturnerx
Member
**
Offline Offline

Activity: 84
Merit: 10


View Profile
May 27, 2011, 03:47:58 PM
 #5

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.
merlz
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
May 30, 2011, 05:29:34 AM
 #6

I'd be happy to play around with this/improve this if you can get some initial code running :-)
KnuttyD
Member
**
Offline Offline

Activity: 109
Merit: 11



View Profile
May 30, 2011, 06:24:53 AM
 #7

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!

If I helped you in some way, and you feel obligated to do so, you can tip me some coin!
1KVadqbELY3KuJhkm9rDtcwxZknhRsfPHY
BombaUcigasa
Legendary
*
Offline Offline

Activity: 1442
Merit: 1000



View Profile
May 30, 2011, 09:27:34 AM
 #8

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".



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:
nallar
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
May 30, 2011, 10:01:07 AM
 #9

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... Sad)

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 Smiley)
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. Smiley
In this case, I still think you'd only get ~50MH/s for $200. Sad
(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 Smiley)


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 Cheesy)

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.
commlinx
Full Member
***
Offline Offline

Activity: 294
Merit: 100



View Profile
May 30, 2011, 10:07:39 AM
Last edit: May 30, 2011, 10:35:25 AM by commlinx
 #10

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 Wink

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

Activity: 12
Merit: 0


View Profile
May 30, 2011, 10:37:10 AM
 #11

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.
BombaUcigasa
Legendary
*
Offline Offline

Activity: 1442
Merit: 1000



View Profile
May 30, 2011, 11:11:26 AM
Last edit: May 30, 2011, 11:59:03 AM by BombaUcigasa
 #12

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.
commlinx
Full Member
***
Offline Offline

Activity: 294
Merit: 100



View Profile
May 30, 2011, 11:27:19 AM
Last edit: May 30, 2011, 11:39:44 AM by commlinx
 #13

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.
BombaUcigasa
Legendary
*
Offline Offline

Activity: 1442
Merit: 1000



View Profile
May 30, 2011, 11:58:25 AM
 #14

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).
commlinx
Full Member
***
Offline Offline

Activity: 294
Merit: 100



View Profile
May 30, 2011, 12:12:04 PM
 #15

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 Grin.
merlz
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
May 30, 2011, 12:43:01 PM
 #16

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.
commlinx
Full Member
***
Offline Offline

Activity: 294
Merit: 100



View Profile
May 30, 2011, 01:03:15 PM
 #17

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.
Littleshop
Legendary
*
Offline Offline

Activity: 1386
Merit: 1003



View Profile WWW
May 30, 2011, 04:06:25 PM
 #18

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?

BombaUcigasa
Legendary
*
Offline Offline

Activity: 1442
Merit: 1000



View Profile
May 30, 2011, 04:41:47 PM
 #19

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 Cheesy

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.
wolftaur
Member
**
Offline Offline

Activity: 112
Merit: 10


View Profile
May 30, 2011, 04:59:46 PM
 #20

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

"MOOOOOOOM! SOME MYTHICAL WOLFBEAST GUY IS MAKING FUN OF ME ON THE INTERNET!!!!"
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!